cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A358258 First n-bit number to appear in Van Eck's sequence (A181391).

This page as a plain text file.
%I A358258 #21 Nov 07 2022 02:10:12
%S A358258 0,2,6,9,17,42,92,131,307,650,1024,2238,4164,8226,17384,33197,67167,
%T A358258 133549,269119,525974,1055175,2111641,4213053,8444257,16783217,
%U A358258 33601813,67405064,134239260,268711604,538400994,1076155844,2152693259,4299075300,8594396933,17203509931
%N A358258 First n-bit number to appear in Van Eck's sequence (A181391).
%C A358258 Binary version of A358168.
%e A358258 First terms written in binary, substituting "." for 0 to enhance the pattern of 1's.
%e A358258    n      a(n)                   a(n)_2
%e A358258   -------------------------------------
%e A358258    1        0                         .
%e A358258    2        2                        1.
%e A358258    3        6                       11.
%e A358258    4        9                      1..1
%e A358258    5       17                     1...1
%e A358258    6       42                    1.1.1.
%e A358258    7       92                   1.111..
%e A358258    8      131                  1.....11
%e A358258    9      307                 1..11..11
%e A358258   10      650                1.1...1.1.
%e A358258   11     1024               1..........
%e A358258   12     2238              1...1.11111.
%e A358258   13     4164             1.....1...1..
%e A358258   14     8226            1.......1...1.
%e A358258   15    17384           1....11111.1...
%e A358258   16    33197          1......11.1.11.1
%e A358258   17    67167         1.....11..1.11111
%e A358258   18   133549        1.....1..11.1.11.1
%e A358258   19   269119       1.....11.11..111111
%e A358258   20   525974      1........11.1..1.11.
%e A358258   21  1055175     1.......11..111...111
%e A358258   22  2111641    1.......111...1..11..1
%e A358258   23  4213053   1.......1..1..1..1111.1
%e A358258   24  8444257  1.......11.11..1.11....1
%t A358258 nn = 2^20; q[_] = False; q[0] = True; a[_] = 0; c[_] = -1; c[0] = 2; m = 1; {0}~Join~Rest@ Reap[Do[j = c[m]; k = m; c[m] = n; m = 0; If[j > 0, m = n - j]; If[! q[#], Sow[k]; q[#] = True] & @ IntegerLength[k, 2], {n, 3, nn}] ][[-1, -1]]
%o A358258 (Python)
%o A358258 from itertools import count
%o A358258 def A358258(n):
%o A358258     b, bdict, k = 0, {0:(1,)},1<<n-1 if n > 1 else 0
%o A358258     for m in count(2):
%o A358258         if b >= k:
%o A358258             return b
%o A358258         if len(l := bdict[b]) > 1:
%o A358258             b = m-1-l[-2]
%o A358258             if b in bdict:
%o A358258                 bdict[b] = (bdict[b][-1],m)
%o A358258             else:
%o A358258                 bdict[b] = (m,)
%o A358258         else:
%o A358258             b = 0
%o A358258             bdict[0] = (bdict[0][-1],m) # _Chai Wah Wu_, Nov 06 2022
%Y A358258 Cf. A181391, A358168, A358180, A358259.
%K A358258 nonn,base
%O A358258 1,2
%A A358258 _Michael De Vlieger_, Nov 05 2022
%E A358258 a(30)-a(34) from _Chai Wah Wu_, Nov 06 2022
%E A358258 a(35) from _Martin Ehrenstein_, Nov 07 2022