The Natural Number String 0123456789101112131415...
BETA version

The Natural Number String is the infinite string formed by writing out the positive integers in order: 0123456789101112131415... .
Every number will eventually appear in the string of course, but some also appear earlier than expected, such as "12" which is between numbers "0" and "3" as well as its natural place between "11" and "13". Here are some other mathematical investigations at school level (pre-university).
Contents of this page
The You Do The Maths... icon means there is a You Do The Maths... section of questions to start your own investigations.
The calculator calculator icon indicates that there is a live interactive calculator in that section.

The Early Bird Numbers

There are several interesting questions we can ask about this string of digits:
0123456789101112131415...
where we write down the numbers in order but with no gaps.
If we need to show where we are in the sequence in terms of the separate natural numbers we will separate the natural numbers by using '. The sequence would then be
1'2'3'4'5'6'7'8'9'10'11'12'13'14'15' ...
What digit is at position i if the positions start at 0 for number 0 and what number is the digit in?
For example, the digit at position 20 is the 1 in number 15
position0123456789101112131415161718192021...188189...
number0123456789101112131415...99...

Each position (index number) in the string will have in it a particular digit of one of the natural numbers that were joined together. So number 12 in the sequence is in positions 14, 15 and at position 15 is a digit of the number 12. As a string of digits "12" appears in many places in the sequence.
Where in the sequence is the first appearance of the digits of number N?
For example 12 appears at positions which is before its "natural" place in the sequence, at ... and so 12 is called an Early Bird number.
Find all the positions at which a string occurs.
For example:
up to position 99 (in number 54) '0' occurs 6 times at positions : 0, 11, 31, 51, 71, 91 in numbers: 0, 10, 20, 30, 40, 50.
Count the frequencies of the digits in any range of numbers
For example, the digit counts in all two digit numbers are
A numbers that appears earlier than "expected" (that is, at its "natural position") is called an Early Bird number, such as 12. See A116700.
If a number first appears at its natural position, not earlier, then it can perhaps be called a punctual number, such as 2 or 3 or 13. See A131881

You Do The Maths...

  1. 12 is the first Early Bird number because it first appears in positions 1,2 in the string. Can you find another such number?
    The next is 21 in 12'13
  2. Find all 10 Early Bird numbers less than 50
    12, 21, 23, 31, 32, 34, 41, 42, 43, 45
    1. Why are all the numbers 91, 92, 93, 94, 95, 96, 97, 98, 99 Early Bird numbers?
      91 appears early at '9'10
      92 appears early at 19'20
      and so on up to
      99 appears early at 89'90
    2. Are 90 and 100 Early Birds?
      No number begins with 0 (except 0 itself) so these two numbers cannot be Early Birds
Check your answers using  in range  in the Calculator below.

Plots

Here is some plots of
EarlyBird plot
First positions:
All Early positions:
All positions:

The Natural Number Sequence Calculator

Base
set the number base for all parts of the Calculator. The usual base is 10 but it can vary from 2 to 36. Use digits 0 1 2 3 4 5 6 7 8 9 a b c d e f ... x y z, upper or lower case.
The positions input
are given as ordinary (base 10) numbers always and start with number 0 in position 0 (at index number 0).
Positions can be arbitrarily large! Spaces are ignored.
For example:
In the (base 10) sequence, the 10 000 000 000 000 000 000 000-th digit (10^22 or the ten billion trillion-th) is the middle 4 in the number 481481481481481481481
number(s) in position(s):
What numbers are in the given positions (index numbers) is the natural-sequence-string for the given number Base at the top?
For the digit at a single position you can leave the 'up to' input empty.
for a digit string in the given positions
The digit string must be valid in the Base at the top of the Calculator and can be any string of digits and may begin with 0 such as '012' or '00'.
the Numbers input
the numbers in the range on the right can be given as ordinary (base 10) numbers or their Base equivalent if the 'in base' indicator is selected, which will then use the Base as indicated at the top of the Calculator. Spaces in the input are ignored.
For a single number you may leave 'up to' blank.

Some calculations in this section allow arbitrarily large numbers but others need smaller integers in this version of the calculator as they perform a 'brute force' search.
[Restricted numbers] means:
The Calculator may have to search up to the 'natural position' of the numbers and this is not recommended for a search involving more than

the first position
just one position is returned, which is always less than or equal to the natural position.
[Restricted numbers]
the natural position
is the position the number occurs in the natural sequence order, that is, as a single number n with n-1 before it and n+1 after.
The number(s) can be arbitrarily large! For example:
The base 10 number 12345679012345678901234567890 is at 'natural position' 346913580246913577024691357700..346913580246913577024691357728.
all early positions
all the positions the number is found in are reported up to and including the natural position of the number(s). [Restricted numbers]
[EarlyBirds, non-Early Birds]
Using the given number range all the (non-) Early Birds are found and the total number reported. [Restricted numbers]
[EarlyBirds, non-Early Birds]
Same as COUNT but the relevant numbers are also shown in the output. [Restricted numbers]
digit frequencies
the frequency of each digit for the given Base is found and counted using all the numbers in the specified number range.
The numbers can be arbitrarily large.
a number to/from base 10
give a base 10 number to convert to the Base at the top of the Calculator or
give a valid number in the Base at the top to convert to base 10.
The number to convert can be arbitrarily large!
C A L C U L A T O R
Natural Number String in base
number(s) in position

up to
for digit string
of number

up to

in range
digit frequencies in


R E S U L T S
Here are some patterns in the natural number sequence:
PositionNumber
11 111 111 111 1 222 222 222
22 222 222 222 2 333 333 333
33 333 333 333 3 444 444 444
44 444 444 444 4 555 555 555
55 555 555 555 5 666 666 666
66 666 666 666 6 777 777 777
77 777 777 777 7 888 888 888
88 888 888 888 8 999 999 999
99 999 999 999 10 101 010 100
PositionNumber
111 111 111 111 11 111 111 111
222 222 222 222 21 212 121 212
333 333 333 333 31 313 131 313
444 444 444 444 41 414 141 414
555 555 555 555 51 515 151 515
666 666 666 666 61 616 161 616
777 777 777 777 71 717 171 717
888 888 888 888 81 818 181 818
999 999 999 999 91 919 191 919
PositionNumber
1110
222110
33331110
4444411110
555555111110
66666661111110
7777777711111110
888888888111111110
99999999991111111110
Can you explain these (find mathematical formulas and prove them)?
Can you find any more similar to these?
The following Investigation Section should help you start...

You Do The Maths...

    1. How many digits are there in the sequence 1 .. 9?
    2. How many digits are there in the sequence 10 11 .. 98 99?
    3. How many digits are there in the sequence 100 101 ... 998 999?
    4. Find a formula for:
      1. the first n-digit number
      2. the last n-digit number
      3. the total number of digits in all the n-digit numbers


      There is a nice general formula if we ignore the number 0:
      There are 9 one-digit numbers: so 9 digits in the sequence 1..9
      There are 90 two-digit numbers: so 90×2=180 digits in the sequence 10..99
      There are 900 three-digit numbers: so 900×3=2700 digits in the sequence 100..999
      The n-digit numbers run from 10n−1 up to 10n−1
      which is 10n−10n−1 = (10-1)10n−1= 9 10n−1 numbers with n-digits
      so there are a total of 9 n 10n−1 digits in total across all n-digit numbers.
    5. Following on from the previous investigation, find a formula or else a method of computing the natural starting position of the n-digit numbers , that is what is the natural position of 100, 100, 1000, etc.?
      Check your answer with A033714 ... or ...

      The number of 1 digit numbers (excluding 0 ) is 9,
      with 2 digits is 2×90=180
      with 3 digits is 3×900=2700
      so the n-digit numbers start in the next position after (9+180+2700+36000+...+(n-1)×10n-2).
      This starting position can also be written as 9(1+20+300+4000+...) = n 10n−1 10n−10
      9
    6. Using your answer to the previous investigation, find a method of calculating the natural position of the number N in the sequence.
      See A117804 of the natural positions of all the natural numbers.
      The natural position of n is at d*n + 1 − (10d - 1)
      9

      where d is the number of decimal digits in n: d = floor(log_10(n)) + 1.
      1. Find the 3 places that 121 occurs up to and including its natural position: 253-255.
        Check your answer using   for digit string in position up to with the Calculator... or ...

        Positions 14..16: '12'13
        Positions 227..229: 112'113
        Positions 253..255 '121'
      2. Find the 5 places that 1211 occurs up to and including its natural position: 3734-3737.

        Positions227..230253..256 3340..3343 3375..3378 3734..3737
        digits'112'113' '121'122 '1112'1113' '1121'1122' '1211'
    7. Looking at the Plots above, what can you say about the numbers 90-100, 900-1000 and 9000-10000?
      Check your answer using   in range  in the Calculator for each of these ranges.
    8. Using   in range   in the Calculator, investigate the proportion of numbers which are Early Birds as you go further and further along the sequence.
      Does it look as if the proportion grows or decreases as we go deeper into the sequence?
    9. As the numbers get larger, there are longer and longer runs of Early Bird numbers. For instance,
      • all 14 numbers in the range from 210 to 223 are Early Birds
      • all 100 in the range from 901 to 999
      • all 457 in the range 5100 to 5556
      • all 910 in the range 9091 to 9999!
      Can you identify more of these ranges?
      1. What can you say about the numbers in this series: 90, 900, 9000, ...?
      2. What can you say about the numbers in this series: 91, 901, 90001, ...?
      3. Using your answers to the last two questions,
        1. are there an infinite number of Early Birds?
        2. are there an infinite number of non-Early Birds?
    10. Look at which numbers contain the 10th, 100th, 1000th, ... etc digit in the base 10 sequence.
      What patterns or special numbers do you spot there?
      Can you explain any of the patterns mathematically?
    11. This would make a good Science/Maths Project:
      Take any single digit number and find its natural starting position.
      Take two copies of that digit to make a two-digit number and find its natural position.
      Repeat withthree copies to form a three-digit number and find its natural position.
      Do this a few more times.
      For example:
      Position 5 is natural position of 5
      Positions 100..101 is natural position of 55
      Positions 1555..1557 is natural position of 555
      Positions 21110..21113 is natural position of 5555
      Positions 266665..266669 is natural position of 55555
      Positions 3222220..3222225 is natural position of 555555
      Why do the longer numbers contain a position which ends with a repeated single-digit pattern?
      What happens if you do this starting with a two-digit number?
      Or a three-digit number? or four-digits?
    12. (Hard!) The longest runs of non-Early Bird (base 10) numbers seem to contain 9 numbers, for instance
      1001 and 1011 are Early Birds but all 9 numbers between them are not. Is a longer run possible? Why or why not?
    13. (Hard!) Using the Calculator above to check your answer, find a method of computing all the positions at which a given number string appears in the sequence.
    14. (Hard!) Using the Calculator above to check your answer, find a method of computing the position at which a given number (string of digits) first appears in the sequence.

What about other bases?

The Binary Number String: 0 1 10 11 100 101 111 ...

If we wrote the natural numbers in base 2 (binary), we have
position012345678910111213141516171819202122...
Binary011 01 11 0 01 0 11 1 01 1 11 0 0 0...
n012345678...
Again there is a "natural position" for every binary number n and some binary number strings (bit patterns) appear before their natural position,such as 3=112 which is in positions 1 and 2 as well as its natural place in positions 4-5.

/ You Do The Maths...

  1. Number 3=112 is the first binary Early bird number. What is the next number?
  2. Find all 10 binary Early Bird numbers less than 16.
Check your answers using   in range  in the Calculator above.

Binary Plots

As for the decimal number plots above, here are the plots of the positions (y-axis) of the first occurrences of each binary number (x-axis).
The natural position of each in the topmost sloping line and any points below this indicate that the x-number is a binary Early Bird.
You can also compare these with a plot of all the binary early positions of a number, that is all the staring positions of the binary number string up to its natural position in the binary sequence.
EarlyBird Binary plot
First positions:
All Early positions:
All positions:

/ You Do The Maths...

  1. Which Early Birds start at position 1?
    In other words, if we take the base B natural sequence and ignore the initial zero, by taking the first n digits we have a base B number which must be an Early Bird. What is the sequence for base B?
    For base 10, it is 1, 12, 123, 1234, … , 1234567891, 12345678910, … but for base 2 it is
    1, 11, 110, 1101, 11011, 110111, 1101110, … and as decimal numbers these are
    1, 3, 6, 13, 27, 55, 110, … (A055143), all the base 2 Early Bird numbers whose first appearance is at position 1.
    What are the Early Birds in base 3 that start at position 1?
    What about base 4? base 5?
    Check your answers with base 3:A055144, base 4:A055145, base 5:A055146, base 6:A055147, base 7:A055148, base 8:A055149, base 9:A055150, base 10:A252043.

The decimal number 0.12345678910111213 ...

If we make our infinite number string into a decimal number by putting a decimal point at the start, we can ask some interesting (mathematical) questions about it.

Is it rational (a fraction)?

No, because all rational numbers when written as a decimal will either stop (such as 3/8=0.375) or else end up repeating the same digits in a cycle for ever (such as 1/3=0.33333... or 2/7=0.285714 285714...). Our decimal does not terminate and neither does it end in the same cycle repeating for ever.
Our decimal is therefore of a irrational number - one that cannot be written exactly as a fraction.

Is it like √2, the root of a polynomial?

The square-root of 2 is famously irrational but we can describe it as A polynomial in x is a finite sum of whole number multiples of powers of x such as 5 − 4 x3 or 1 + 2x3 − 3x3 + 7x10.

A root of a polynomial in x is any value for x that makes the polynomial's value 0.
All rational numbers are the roots of a simple polynomial since a/b is the root of b x − a. Similarly, all square-roots √a are - as their name implies - roots of a square polynomial x2 − a.

If a number is the root of some polynomial, it is called an algebraic number
But some numbers, such as π and e and loge(2) are neither rational nor algebraic.
Numbers that are not algebraic are called transcendental. If they are a root of a polynomial then it must be an infinite polynomial, also called a power series.
The French mathematician Joseph Liouville (1809-1882) was the first person to prove that there are numbers that are transcendental.
It seems to be quite difficult to prove a number is transcendental!

However, our decimal 0.12345678910111213... was proved transcendental in a paper in German published in 1937 by Kurt Mahler (1903-1988).
It is sometimes called Champernowne's Number because a few years earlier D G Champernowne had proved that the number is normal in the sense that each digit appears 1/10 of the time in the long run when written as a decimal.

You might think that "each digit appears with the same frequency on average" is a condition for a number to be "random". But for 0.123456789101112... even though the digits are uniformly distributed (each occurs with the same probability in the entire number) it appears to be far from our idea of a "random number" when we write it down!

Champernowne Numbers in different bases

If we concatenate the base 2 numbers we get the base 2 Champernowne Number:
binary Champernowne number: 0.1 10 11 100 101 110 111 1000 ...2
which, as with the other Champernowne numbers to any base, is irrational (not a fraction).
The base 4 value has a remarkable value when written as an ordinary decimal fraction:
base 4 Champernowne number: 0.1 2 3 10 11 12 13 20 21 22 23 ... 33 100 101 ...4 = 0.4261111111111110657645566
The decimal value 0.4261111... = 0.4261 is the fraction 297/697 so this is an excellent approximation to the base 4 Champernowne number!
And - would you believe it for there seems no simple or obvious mathematical reason why - the same thing happens with base 5:
base 5 Champernowne Number: 0.1 2 3 4 10 11 12 13 14 20 21... 44 100 101...5 = 0.31073611111111111111111111111096303...
0.3107361111... = 0.3107361 = 22373/72000
= 0.1234101112131420212223243031323334404142440001...5
and is accurate to 41 base 5 places, the start of the natural position of 23 = 435.
This simple kind of pattern is not repeated for bases 2 and 3 nor for bases 6, 7, 8 however - at least not for base 10 decimals. But if we are looking for simple patterns in the decimal expansion, we are overlooking some cases where the decimal pattern is not initially obvious, as for example in 1/7 = 0. 142857 142857 ... and do we know the expansions in other bases? Perhaps there are more patterns in other bases?
There are more facts, figures and Calculators to explore the many patterns on the Decimal Fractions page at this site.

A much easier way to spot these patterns is to be mathematical and use Continued Fractions, and this we begin to explore in the next section.

To find the best fractions approximating a number, we use Continued Fractions. There is an Introduction to Continued Fractions page on this site if you have not met these simple extended fractions before.

Champernowne Numbers and Continued Fractions

For our decimal Champernowne number at the start of this section, its continued fraction (CF) is
0.12345678910111213... = [0; 8, 9, 1, 149083, 1, 1, 1, 4, 1, 1, 1, 3, ...]
The presence of the very large term 149083 in its CF shows that the previous convergent will give a remarkably accurate approximation:
CF termconvergentvalue
0 00
8 1/80.125
9 9/730.12328...
1 10/810.1234567901...
1490831490839/120757960.123456789101108...
If we continue with the CF, we find
0.12345678910111213... = [0; 8, 9, 1, 149083, 1, 1, 1, 4, 1, 1, 1, 3, 4, 1, 1, 1, 15, 4575401113910310764836466282429561185996039397104575550006620043930902626592563149379532077471286563138641209375503552094607183089984575801469863148833592141783010987, 6, 1, 1, 21, 1, 9, 1, 1, ...]
That 19-th element has 166 digits and the CF is correct to 355 decimal places!
The CF continues with small numbers (no more than 3 digits) until the 41-st which has 2504 digits.
The number of digits in each CF term is given by 0, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 166, ... A143532. The astonishingly large numbers appear at positions 5, 19, 41, 163, ... A038705 and the number of digits in these "high water mark" elements are 6, 166, 2504, 33102, ... A143534.

We have something similar for the base 2 Champernowne number:

0.110111001011101111000...2 = 0.8622401258680545715577903...
continued fraction: [0; 1, 6, 3, 1, 6, 5, 3, 3, 1, 6, 4, 1, 3, 298, 1, 6, 1, 1, 3, 285, 7, 2, 4, ...]
convergent at 298 term: 474023339/549757921 = 0.86224012586805456869...
and in binary this is accurate to 54 binary places or to the natural position of 16 = 100002:
474023339/549757921 = 0.110111001011101111000100110101011110011011110111110000011...2
The base 3, 4, 5 and 6 Champernowne numbers from above have these CFs and convergents:
base 3: 0.59895816753843399250017... =[0;1,1,2,37,1,162,1,1,1,3,1,7,1,9,2,3,1,3068518062211324,2,1,2,6,13,1,2,...]
convergents: 0,1,1/2,3/5,112/187,115/192,18742/31291,18857/31483,37599/62774,56456/94257,206967/345545,263423/439802,2050928/3424159,2314351/3863961,22880087/38199808,48074525/80263577,167103662/278990539,215178187/359254116,660278153403386076293250/1102377743869762487800123,... 660278153403386076293250/1102377743869762487800123 is correct to 49 dps.

base 4: 0.42611111111111106576455... = [0;2,2,1,7,1,1,2,1,1,1,1,6806293849,1,33,157,1,2,1...]
convergents: 0,1/2,2/5,3/7,23/54,26/61,49/115,124/291,173/406,297/697,470/1103,767/1800, ...
767/1800 = 0.4261 so is correct to 15 dps.

base 5: 0.3107361111111111111111111111109630333... = [0;3,4,1,1,2,2,18,1,20,1302701925685142513155, ...]
convergents: 0,1/3,4/13,5/16,9/29,23/74,55/177,1013/3260,1068/3437,22373/72000, ...
22373/72000 = 0.3107361 correct to 29 dps (44 base 5 places) with the next convergent being accurate to 51 dps or 75 base 6 digits.

base 6: 0.2398626858150667674477198286722096245905769715293502137... = [0;4,5,1,10,1,4,3,9,1,2,2,1,1,699745284439054751106354294914368414245,...]
convergents: 0,1/4,5/21,6/25,65/271,71/296,349/1455,1118/4661,10411/43404,11529/48065,33469/139534,78467/327133,111936/466667,190403/793800,133233601393049341774903176814580489177602671/555457806787721661428224039303025647228147667
190403/793800 = 0.23986268581506676744771982867220962459057697152935248173... correct to 49 dps (65 places in base 6). The next convergent increases the accuracy to 88 dps or 115 base 6 digits!

This phenomenon continues to all subsequent bases!
For base 7, the amazingly accurate fraction 7529191/38723328 is correct to 77 decimal places; base 8 has 84934399/520224768 with an accuracy of 108 dps and base 9's approximation of 4304671369/30611001600 is correct to 146 dps!
The first 'best approximations' to the Champernowne number in base b>3, are b/(b − 1)2
bChampernowne base b = b/(b−1)2 + error
20.86224012586805457155... = 2/3 +1.9557...×10-1
30.59895816753843399250... = 3/4 −1.5104...×10-1
40.42611111111111106576... = 4/9 −1.8333...×10-2
50.31073611111111111111... = 5/16 −1.7638...×10-3
60.23986268581506676745... = 6/25 −1.3731...×10-4
70.19443553508624052148... = 7/36 −8.9093...×10-6
80.16326481210521679737... = 8/49 −4.9401...×10-7
90.14062497611969678248... = 9/64 −2.3880...×10-8
100.12345678910111213142... = 10/81 −1.0223...×10-9
110.10999999996074151908... = 11/100 −3.9258...×10-11
120.099173553717641915701... = 12/121 −1.3663...×10-12
130.090277777777734303759... = 13/144 −4.3474...×10-14
140.082840236686389258763... = 14/169 −1.2737...×10-15
150.076530612244897924602... = 15/196 −3.4581...×10-17
160.071111111111111110237... = 16/225 −8.7460...×10-19

A Champernowne Number CF Calculator

Try the Fraction & Decimal CF Calculator which opens in a new window (tab) and uses Big Numbers (multiprecision integers and decimals).
Put champ(10) into the Decimal input box and press the arrow to convert it to a CF.
Alter the Working precision to get more decimal places or more CF terms.

References and Follow-Up links


Valid CSS level 3! Valid HTML 4.01! © 2016 Dr Ron Knott
created November 2016;