A358259 Positions of the first n-bit number to appear in Van Eck's sequence (A181391).
1, 5, 10, 24, 41, 52, 152, 162, 364, 726, 1150, 2451, 4626, 9847, 18131, 36016, 71709, 143848, 276769, 551730, 1086371, 2158296, 4297353, 8607525, 17159741, 34152001, 68194361, 136211839, 271350906, 541199486, 1084811069, 2165421369, 4331203801, 8643518017, 17303787585
Offset: 1
Examples
First terms written in binary, substituting "." for 0 to enhance the pattern of 1's. n a(n) a(n)_2 ------------------------------------- 1 1 1 2 5 1.1 3 10 1.1. 4 24 11... 5 41 1.1..1 6 52 11.1.. 7 152 1..11... 8 162 1.1...1. 9 364 1.11.11.. 10 726 1.11.1.11. 11 1150 1...111111. 12 2451 1..11..1..11 13 4626 1..1....1..1. 14 9847 1..11..111.111 15 18131 1...11.11.1..11 16 36016 1...11..1.11.... 17 71709 1...11......111.1 18 143848 1...11...1111.1... 19 276769 1....111..1..1....1 20 551730 1....11.1.11..11..1. 21 1086371 1....1..1..111.1...11 22 2158296 1.....111.111.11.11... 23 4297353 1.....11..1..1.1...1..1 24 8607525 1.....11.1.1.111..1..1.1 etc.
Programs
-
Mathematica
nn = 2^20; q[] = False; q[0] = True; a[] = 0; c[_] = -1; c[0] = 2; m = 1; {1}~Join~Rest@ Reap[Do[j = c[m]; k = m; c[m] = n; m = 0; If[j > 0, m = n - j]; If[! q[#], Sow[n]; q[#] = True] & @ IntegerLength[k, 2], {n, 3, nn}] ][[-1, -1]]
-
Python
from itertools import count def A358259(n): b, bdict, k = 0, {0:(1,)},1<
1 else 0 for m in count(2): if b >= k: return m-1 if len(l := bdict[b]) > 1: b = m-1-l[-2] if b in bdict: bdict[b] = (bdict[b][-1],m) else: bdict[b] = (m,) else: b = 0 bdict[0] = (bdict[0][-1],m) # Chai Wah Wu, Nov 06 2022
Extensions
a(30)-a(34) from Chai Wah Wu, Nov 06 2022
a(35) from Martin Ehrenstein, Nov 07 2022
Comments