login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A122953 a(n) = number of distinct positive integers represented in binary which are substrings of binary expansion of n. 13
1, 2, 2, 3, 3, 4, 3, 4, 4, 4, 5, 6, 6, 6, 4, 5, 5, 5, 6, 6, 5, 7, 7, 8, 8, 8, 8, 9, 9, 8, 5, 6, 6, 6, 7, 6, 7, 8, 8, 8, 8, 6, 8, 10, 9, 10, 9, 10, 10, 10, 10, 11, 10, 10, 11, 12, 12, 12, 12, 12, 12, 10, 6, 7, 7, 7, 8, 7, 8, 9, 9, 8, 7, 9, 10, 10, 11, 11, 10, 10, 10, 10, 11, 9, 7, 11, 11, 13, 13, 12 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

a(n) = A078822(n) if n is of the form 2^k - 1. Otherwise, a(n) = A078822(n) - 1.

First occurrence of k: 1, 2, 4, 6, 11, 12, 22, 24, 28, 44, 52, 56, 88, 92, 112, 116, 186, 184, 220, 232, 244, 368, 376, 440, 472, ... (See A292924 for the corresponding sequence. - Rémy Sigrist, Mar 09 2018)

Last occurrence of k: 2^k - 1.

a(n) = sum (A057427(A213629(n,k): k = 1 .. n). - Reinhard Zumkeller, Jun 17 2012

Length of n-th row in triangle A165416. - Reinhard Zumkeller, Jul 17 2015

LINKS

Jeremy Gardiner, Table of n, a(n) for n = 1..2000

EXAMPLE

Binary 1 = 1, binary 2 = 10, binary 4 = 100 and binary 9 = 1001 are all substrings of binary 9 = 1001. So a(9) = 4.

MATHEMATICA

f[n_] := Length@ Select[ Union[ FromDigits /@ Flatten[ Table[ Partition[ IntegerDigits[n, 2], i, 1], {i, Floor[ Log[2, n] + 1]}], 1]], # > 0 &]; Array[f, 90]

PROG

(Haskell)

a122953 = length . a165416_row

-- Reinhard Zumkeller, Jul 17 2015, Jan 22 2012

(PARI) a(n) = my (v=0, s=0, x=Set()); while (n, my (r=n); while (r, if (r < 100 000, if (bittest(s, r), break, s+=2^r), if (setsearch(x, r), break, x=setunion(x, Set(r)))); v++; r \= 2); n -= 2^(#binary(n)-1)); v \\ Rémy Sigrist, Mar 08 2018

CROSSREFS

Cf. A078822, A292924.

Cf. A057427, A213629, A165416.

Sequence in context: A117119 A208280 A139141 * A259847 A259103 A334200

Adjacent sequences:  A122950 A122951 A122952 * A122954 A122955 A122956

KEYWORD

nonn,base

AUTHOR

Leroy Quet, Oct 25 2006

EXTENSIONS

More terms from Robert G. Wilson v, Nov 01 2006

Keyword base added by Rémy Sigrist, Mar 08 2018

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 6 15:25 EDT 2020. Contains 334827 sequences. (Running on oeis4.)