login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A165956 a(0) = 1. For n >= 1, a(n) = the number of earlier terms that, when written in binary, are substrings in binary n. 1

%I #25 Mar 21 2023 07:16:39

%S 1,1,2,2,4,4,4,2,8,8,5,6,9,7,7,4,11,11,10,10,12,8,9,10,14,13,11,11,14,

%T 12,10,4,13,13,13,13,12,13,13,14,18,17,10,15,19,18,16,13,18,18,20,17,

%U 26,21,19,21,22,21,26,24,20,21,12,5,14,14,14,14,15,17,17,19,19,16,23,22,21

%N a(0) = 1. For n >= 1, a(n) = the number of earlier terms that, when written in binary, are substrings in binary n.

%C If we instead had an offset of 1 and a(1)=1, then we would have sequence A122954.

%H John Tyler Rascoe, <a href="/A165956/b165956.txt">Table of n, a(n) for n = 0..10000</a>

%e 13 in binary is 1101. The earlier terms that, when written in binary, are substrings in 1101 are: a(0)=1, a(1)=1, a(2) = 2 = 10 in binary, a(3) = 2 = 10 in binary, a(7) = 2 = 10 in binary, a(10) = 5 = 101 in binary, and a(11) = 6 = 110 in binary. There are 7 such terms, so a(13) = 7.

%o (Python)

%o from collections import Counter

%o def A165956_list(nmax):

%o A,C = [1],Counter()

%o for n in range(1,nmax+1):

%o b = bin(n)[2:]

%o C.update({bin(A[-1])[2:]})

%o A.append(sum(C[i] for i in C if b.find(i) != -1))

%o return A # _John Tyler Rascoe_, Mar 11 2023

%Y Cf. A122954.

%K base,nonn

%O 0,3

%A _Leroy Quet_, Oct 01 2009

%E More terms from _Sean A. Irvine_, Nov 09 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 26 20:34 EDT 2024. Contains 372004 sequences. (Running on oeis4.)