|
|
A043545
|
|
(Maximal base-2 digit of n) - (minimal base-2 digit of n).
|
|
12
|
|
|
0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
0 followed by a string of 2^k - 1 1's. Also a(n)=0 iff n = 2^m - 1.
G.f.: 1/(1-x) - Sum_{k>=0} x^(2^k-1). - Michael Somos, Aug 25 2003
a(n) = (1 + (-1)^binomial(n, floor(n/2)))/2. - Paul Barry, Jun 07 2006
|
|
EXAMPLE
|
G.f. = x^2 + x^4 + x^5 + x^6 + x^8 + x^9 + x^10 + x^11 + x^12 + x^13 + ...
|
|
MATHEMATICA
|
mb2d[n_]:=Module[{n2=IntegerDigits[n, 2]}, Max[n2]-Min[n2]]; Array[mb2d, 120, 0] (* Harvey P. Dale, Feb 24 2015 *)
|
|
PROG
|
(PARI) {a(n) = if( n<0, 0, n++; n != 2^valuation(n, 2))}; /* Michael Somos, Aug 25 2003 */
(Haskell)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|