OFFSET
0,1
LINKS
FORMULA
a(n) = Sum_{k >= 0} 2^k*(1-(-1)^floor((n+prime(k+1))/2^k))/2.
EXAMPLE
The array before the columns are shifted upwards:
--------- <- the "zero" line
....00000
....00001
....00010
....00011
....00100
....00101
....00110
....00111
....01000
.........
After the upwards shifts:
....0
....0
....0
....0
....00
....00
....000
....000
....0000
....00000
....00111
--------- <- the "zero" line
....00110 = 6
....01101 = 13
....01100 = 12
....01011 = 11
....01010 = 10
....11001 = 25
....11000 = 24
....11111 = 31
....11110 = 30
.........
PROG
(PARI) {a(n) = local(s, m, k); s=0; k=0; while(1, m=floor((n+prime(k+1))/2^k); if(m==0, return(s)); if(m%2, s+=2^k); k++)} (Alekseyev)
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
N. J. A. Sloane and Philippe Deléham, Feb 13 2005
EXTENSIONS
More terms from Max Alekseyev, May 17 2005
STATUS
approved