|
|
A089263
|
|
First differences of A080791.
|
|
1
|
|
|
0, 0, 1, -1, 2, -1, 0, -1, 3, -1, 0, -1, 1, -1, 0, -1, 4, -1, 0, -1, 1, -1, 0, -1, 2, -1, 0, -1, 1, -1, 0, -1, 5, -1, 0, -1, 1, -1, 0, -1, 2, -1, 0, -1, 1, -1, 0, -1, 3, -1, 0, -1, 1, -1, 0, -1, 2, -1, 0, -1, 1, -1, 0, -1, 6, -1, 0, -1, 1, -1, 0, -1, 2, -1, 0, -1, 1, -1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
COMMENTS
|
Number of trailing zeros in the binary representation of n, minus one if n is not a power of two.
|
|
LINKS
|
|
|
FORMULA
|
a(0)=0, a(2n) = a(n) + 1, a(2n+1) = -1 + [n==0].
G.f.: sum(k>=0, t^2/(1+t), t=x^2^k).
|
|
PROG
|
(PARI) a(n)=if(!n, n, (valuation(n, 2)+(2^valuation(n, 2)==n)-1)); \\ Check for n=0 added by Antti Karttunen, Sep 27 2018
(PARI) a(n)=if(n<1, 0, if(n%2==0, a(n/2)+1, -1+(((n-1)/2)==0)))
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|