What is the rule of forming the following sequence : 0,1,10,2,100,11,1000,3,20,101,10000,12,100000,1001,110,4,1000000,21,......
(In reply to
Very strong hints by Jer)
The position values from right to left are not powers of some base, but rather successive prime numbers starting with the first prime, 2. And the digits placed in those positions are not the multiple of the place value used in adding to the total value of the number, but rather the power to which the place value is raised in multiplying out to the total value of the number.
Thus as Jer has pointed out, 20 is represented by 102, as 20 = 5^1 * 3^0 * 2^2. In the originals given in the puzzle within the sequence, 9 is represented by 20, as 9 = 3^2 * 2^0.
The primes themselves all begin with a 1 and the rest of the digits are zero, and each has the number of digits as its ordinality in the list of primes.
An encoding algorithm, invoked for the first 45 natural numbers:
10 for N=1 to 45
20 Nc=N:Pno=1:S=""
25 if Nc=1 then S="0"
30 while Nc>1
40 Ct=0
50 while Nc @ prm(Pno)=0
60 inc Ct
70 Nc=Nc//prm(Pno)
80 wend
90 S=mid("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ct+1,1)+S
95 inc Pno
100 wend
110 print N,S
120 next
1 0
2 1
3 10
4 2
5 100
6 11
7 1000
8 3
9 20
10 101
11 10000
12 12
13 100000
14 1001
15 110
16 4
17 1000000
18 21
19 10000000
20 102
21 1010
22 10001
23 100000000
24 13
25 200
26 100001
27 30
28 1002
29 1000000000
30 111
31 10000000000
32 5
33 10010
34 1000001
35 1100
36 22
37 100000000000
38 10000001
39 100010
40 103
41 1000000000000
42 1011
43 10000000000000
44 10002
45 120
|
Posted by Charlie
on 2013-09-12 00:15:39 |