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.

A342303 a(0) = 1; for n >= 1, a(n) = the decimal value of the binary number of the total binary digits back from the end of the concatenation of all previous binary terms where the binary value of n last appeared. If the binary value of n has not previously appeared then a(n) = 0.

This page as a plain text file.
%I A342303 #20 Mar 18 2022 09:24:31
%S A342303 1,1,0,3,0,5,6,4,0,0,7,14,0,16,10,15,13,0,21,0,39,10,58,8,0,49,16,81,
%T A342303 68,36,49,72,0,39,33,25,25,0,40,16,11,106,6,7,0,9,10,26,60,85,11,70,
%U A342303 40,9,214,30,32,52,16,0,65,30,6,226,0,24,130,161,20,0,99,0,68,216,136,0,62,26,129
%N A342303 a(0) = 1; for n >= 1, a(n) = the decimal value of the binary number of the total binary digits back from the end of the concatenation of all previous binary terms where the binary value of n last appeared. If the binary value of n has not previously appeared then a(n) = 0.
%C A342303 The longest run of 0 terms, corresponding to binary values that have not previously appeared, for n up to 100000 is four, starting at n = 512. Not all powers of 2 are 0 as it may have appeared as a previous value's offset, e.g., a(65536) = 412323.
%H A342303 Scott R. Shannon, <a href="/A342303/a342303.png">Image of the first 100000 terms</a>.
%e A342303 a(1) = 1 as the binary string concatenation up to a(0) = '1', and the binary value of 1 is '1' which appears 1 (1_2) digit back from the end of the string.
%e A342303 a(2) = 0 as the binary string concatenation up to a(1) = '11', while the binary value of 2 is '10' which does not appear in the string.
%e A342303 a(3) = 3 as the binary string concatenation up to a(2) = '110', and the binary value of 3 is '11' which appears 3 (11_2) digits back from the end of the string.
%e A342303 a(5) = 5 as the binary string concatenation up to a(4) = '110110', and the binary value of 5 is '101' which appears 5 (101_2) digits back from the end of the string.
%e A342303 a(10) = 7 as the binary string concatenation up to a(9) = '11011010111010000', and the binary value of 10 is '1010' which appears 7 (111_2) digits back from the end of the string.
%o A342303 (Python)
%o A342303 from itertools import count, islice
%o A342303 def agen():
%o A342303     b = "1"
%o A342303     yield 1
%o A342303     for k in count(1):
%o A342303         bk = bin(k)[2:]
%o A342303         idx = b.rfind(bk)
%o A342303         if idx == -1:
%o A342303             yield 0
%o A342303             b += "0"
%o A342303         else:
%o A342303             yield len(b) - idx
%o A342303             b += bin(len(b) - idx)[2:]
%o A342303 print(list(islice(agen(), 79))) # _Michael S. Branicky_, Mar 18 2022
%Y A342303 Cf. A030190, A341766, A342130, A337227, A181391,
%K A342303 nonn,base
%O A342303 0,4
%A A342303 _Scott R. Shannon_, Mar 07 2021