Nothing Special   »   [go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A131813
a(n+1) = number of preceding terms that are contained in a(n) in binary; a(0)=0.
3
0, 1, 1, 2, 4, 5, 5, 6, 5, 7, 3, 3, 4, 6, 8, 7, 6, 9, 7, 7, 8, 8, 9, 8, 10, 8, 11, 10, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 9, 11, 13, 15, 10, 12, 14, 16, 12, 15, 11, 14, 17, 12, 16, 13, 16, 14, 18, 12, 17, 13, 17, 14, 19, 14, 20, 15, 12, 18, 13, 18, 14, 21, 13, 19, 15, 13
OFFSET
0,4
COMMENTS
a(n+1) = #{k: a(k) substring of a(n) in binary representation, 0<=k<=n}.
a(A131814(n)) = n and a(m) <> n for m < A131814(n).
This is an interesting sequence to listen to. - N. J. A. Sloane, Sep 28 2007
EXAMPLE
a(8) = #{a(0), a(1), a(2), a(3), a(7)} = 5;
a(9) = #{a(0), a(1), a(2), a(3), a(5), a(6), a(8)} = 7;
a(10) = #{a(1), a(2), a(9)} = 3.
PROG
(Haskell)
import Data.List (isInfixOf)
a131813 n = a131813_list !! n
a131813_list = 0 : f [[0]] where
f xss = y : f (bin y : xss) where
y = sum $ map (fromEnum . (flip isInfixOf $ head xss)) xss
bin n = if n == 0 then [] else b : bin n' where (n', b) = divMod n 2
-- Reinhard Zumkeller, May 23 2013
CROSSREFS
KEYWORD
nonn,base,hear,look
AUTHOR
Reinhard Zumkeller, Jul 18 2007, Feb 01 2008
STATUS
approved