Description (from Rosetta Code)
The fusc integer sequence is defined as:
Note that MathWorld's definition starts with unity, not zero. This task will be using the OEIS' version (above).
where A is some non-negative integer expressed in binary, and where B is the binary value of A reversed.
Fusc numbers are also known as:
Task 1. Showing the first 61 fusc numbers (starting at zero) in a horizontal format.
First, let us define the Fusc function:
Task 2. Showing the fusc number (and its index) whose length is greater than any previous fusc number length
The Fusc function previously defined is slow. In the next program results are stored in a list for future retrieving.
The n parameter is the maximum Fusc number to be calculated.
The first column is the index, and the second one is the Fusc number.
- It is faster but requires much more memory. The last call involved the creation of a list of 20'000,000 numbers.
- The first number (and index) is 1 and not 0, because the call of Digits(0) produces an empty list instead of a list with the digit 0.
Showing all numbers with commas (if appropriate)
In Fōrmulæ, all numbers are shown with group separator when necessary. In fact, the group separator is not always the comma, it depends of the locale, see Visualization of numbers
The following is an example of the output if you are in France.
The following is an example of the output if you are in Italy.