Consider the sequence
1, 7, 8, 49, 50, 56, 57, 343, ...
which consists of sums of distinct powers of 7, that is, 70, 71, 70+71, 72, ... in increasing order. At what position will 16856 occur in this sequence?
The sequence can be produced by converting n to base 2 and then treating the set of digits as a base 7 number:
(and 16856 occurs in position 36)
base-2 or
position -7 sequence
1 1 1
2 10 7
3 11 8
4 100 49
5 101 50
6 110 56
7 111 57
8 1000 343
9 1001 344
10 1010 350
11 1011 351
12 1100 392
13 1101 393
14 1110 399
15 1111 400
16 10000 2401
17 10001 2402
18 10010 2408
19 10011 2409
20 10100 2450
21 10101 2451
22 10110 2457
23 10111 2458
24 11000 2744
25 11001 2745
26 11010 2751
27 11011 2752
28 11100 2793
29 11101 2794
30 11110 2800
31 11111 2801
32 100000 16807
33 100001 16808
34 100010 16814
35 100011 16815
36 100100 16856
37 100101 16857
38 100110 16863
39 100111 16864
40 101000 17150
41 101001 17151
42 101010 17157
43 101011 17158
44 101100 17199
45 101101 17200
46 101110 17206
47 101111 17207
48 110000 19208
49 110001 19209
50 110010 19215
51 110011 19216
52 110100 19257
53 110101 19258
54 110110 19264
55 110111 19265
56 111000 19551
57 111001 19552
58 111010 19558
59 111011 19559
60 111100 19600
61 111101 19601
62 111110 19607
63 111111 19608
64 1000000 117649
65 1000001 117650
66 1000010 117656
67 1000011 117657
68 1000100 117698
69 1000101 117699
70 1000110 117705
71 1000111 117706
72 1001000 117992
73 1001001 117993
74 1001010 117999
75 1001011 118000
76 1001100 118041
77 1001101 118042
78 1001110 118048
79 1001111 118049
80 1010000 120050
81 1010001 120051
82 1010010 120057
83 1010011 120058
84 1010100 120099
85 1010101 120100
86 1010110 120106
87 1010111 120107
88 1011000 120393
89 1011001 120394
90 1011010 120400
91 1011011 120401
92 1011100 120442
93 1011101 120443
94 1011110 120449
95 1011111 120450
96 1100000 134456
97 1100001 134457
98 1100010 134463
99 1100011 134464
100 1100100 134505
for n=1:100
s=dec2bin(n);
n2=base2dec(s,7);
fprintf('%6d %10s %10d\n',n,s,n2)
end
|
Posted by Charlie
on 2024-08-20 10:57:01 |