I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
COST (GBP)
this unit 1.40
sub units 0.00
+
0

Morse Thue Number

Calculates the Morse-Thue number of the given order.
Controller: CodeCogs

add cart

Interface

C++
Excel

Morse Thue Number

 
intmorse_thue_numberintn )
The Morse-Thue sequence can be defined in a number of ways.

1) Start with the string containing the single letter '0'; then repeatedly apply the replacement rules '0' -> '01' and '1' -> '10' to the letters of the string. The Morse-Thue sequence is the resulting letter sequence.

2) Starting with the string containing the single letter '0', repeatedly append the binary complement of the string to itself. Thus, '0' becomes '0' + '1' or '01', then '01' becomes '01' + '10', which becomes '0110' + '1001', and so on.

3) Starting with n equal to zero, the n-th Morse-Thue number is determined by taking the binary representation of n, adding the digits, and computing the remainder modulo 2. This is also the formula used with this algorithm.

Example:

#include <codecogs/maths/combinatorics/sequences/morse_thue_number.h>
#include <iostream>
int main()
{
  std::cout << "The first 10 terms of the Morse-Thue sequence" << std::endl;
  for (int i = 0; i < 10; i++)
    std::cout << Maths::Combinatorics::Sequences::morse_thue_number(i) << "  ";
  std::cout << std::endl;
  return 0;
}

Output:

The first 10 terms of the Morse-Thue sequence
0  1  1  0  1  0  0  1  1  0

References:

SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

Parameters

nthe desired order

Returns

the Morse-Thue number of order n

Authors

Lucian Bentea (August 2005)
Source Code

Source code is available when you buy a Commercial licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.