OFFSET
0,4
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..16384
FORMULA
a(n) is odd if and only if n is an odd square (A016754).
MATHEMATICA
divisors[0] := {}; divisors[n_] := Divisors[n];
a[n_] := Total[Table[BitAnd[d , n/d], {d, divisors[n]}]] ;
Table[a[n], {n, 0, 81}]
PROG
(Sage) def a(n): return sum(d & n//d for d in divisors(n)) if n > 0 else 0
print([a(n) for n in (0..81)])
(PARI) a(n) = if (n, sumdiv(n, d, bitand(d, n/d)), 0); \\ Michel Marcus, Oct 11 2019
(Magma) [0] cat [&+[BitwiseAnd(d, n div d):d in Divisors(n)]:n in [1..90]]; // Marius A. Burtea, Oct 11 2019
(Julia)
using IntegerSequences
vcat([0], [V327987(n) for n in 1:81]) |> println # Peter Luschny, Sep 25 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Oct 11 2019
STATUS
approved