login
A175879
Numbers arising from certain regular binary expansions.
1
0, 1, 2, 7, 12, 29, 58, 123, 240, 501, 998, 2023, 4040, 8137, 16266, 32671, 65300, 130837, 261682, 523827, 1047592, 2096237, 4192366, 8386671, 16773312, 33550545, 67100882, 134210007, 268419484, 536854941, 1073709994, 2147451819
OFFSET
0,3
COMMENTS
Consider infinite 0-1 matrix (which expands left and down).
Last column is 010101 ... (alters every step)
Previous is 00110011 ... (alters every 2 steps)
Previous to previous is 000111000111 ... (alters every 3 steps)
Etc. ...
Now a(n) are values of binary numbers coded by rows.
FORMULA
a(0) = 0;
a(n) = \sum_{k=1}^n 2^{k-1}\odd(n \div k)
MAPLE
Contribution from R. J. Mathar, Oct 08 2010: (Start)
A175879 := proc(n) local a, k, ndivk ; a := 0 ; for k from 1 to n do ndivk := floor(n/k) ; if type(ndivk, 'odd') then a := a+2^(k-1) ; fi ; end do: a ; end proc:
seq(A175879(n), n=0..40) ; (End)
MATHEMATICA
f[n_] := Sum[ If[ OddQ[ Floor[ n/k]], 2^(k - 1), 0], {k, n}]; Array[f, 32, 0]
PROG
Contribution from Kamburelis Anastasios (akamb(AT)epp.teicrete.gr), Oct 09 2010: (Start)
(Other) (* Pascal pseudo code *)
var n, a, p, k : integer;
readln(n); (* read index *)
p:= 1; (* powers of 2 *)
a:= 0;
for k:= 1 to n do
begin
if odd( n div k ) then a:= a+p;
p:= 2*p
end;
writeln(a); (* here a = a(n) *)
(End)
CROSSREFS
Sequence in context: A177747 A288888 A293621 * A102371 A007230 A290234
KEYWORD
easy,nonn
AUTHOR
Kamburelis Anastasios (akamb(AT)epp.teicrete.gr), Oct 07 2010
EXTENSIONS
Extended by R. J. Mathar, Oct 08 2010
STATUS
approved