[go: up one dir, main page]

login
A089313
Write n in binary; a(n) = number represented by second block of 1's from the right.
4
0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 3, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 3, 3, 3, 0, 7, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 0, 3, 3, 3, 3, 1, 3, 3, 0, 7, 7, 7, 0, 15, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 7, 1, 1, 0, 3, 3, 3, 1, 3, 3, 1, 1
OFFSET
0,14
FORMULA
a(n) = 2^A089310(n)-1. - David Wasserman, Sep 09 2005
EXAMPLE
13 = 1101 so a(13) = 3.
PROG
(PARI) { a(n) = local(b, l, r, c); b=binary(n); l=length(b); while(l&&b[l]==0, l--); while(l&&b[l]==1, l--); while(l&&b[l]==0, l--); r=0; c=0; while(l&&b[l], r+=2^c; l--; c++); r; } for(i=0, 200, print1(a(i), ", ")) (Klasen)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Dec 22 2003
EXTENSIONS
More terms from David Wasserman and Lambert Klasen (Lambert.Klasen(AT)gmx.net), Sep 09 2005
STATUS
approved