OFFSET
0,3
COMMENTS
If we instead had an offset of 1 and a(1)=1, then we would have sequence A122954.
LINKS
John Tyler Rascoe, Table of n, a(n) for n = 0..10000
EXAMPLE
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.
PROG
(Python)
from collections import Counter
def A165956_list(nmax):
A, C = [1], Counter()
for n in range(1, nmax+1):
b = bin(n)[2:]
C.update({bin(A[-1])[2:]})
A.append(sum(C[i] for i in C if b.find(i) != -1))
return A # John Tyler Rascoe, Mar 11 2023
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Oct 01 2009
EXTENSIONS
More terms from Sean A. Irvine, Nov 09 2009
STATUS
approved