login
A329162
a(n) = Sum_{k<n} ((2^n-1) mod (2^k-1)).
1
0, 0, 1, 1, 5, 4, 13, 14, 28, 30, 69, 60, 131, 144, 263, 267, 549, 530, 1077, 1100, 2085, 2140, 4301, 4186, 8364, 8558, 16623, 16744, 33515, 33164, 66357, 66936, 131849, 132656, 265187, 263571, 527177, 530100, 1052039, 1054214, 2108467, 2103240, 4206521, 4216716, 8400159, 8411752, 16823549
OFFSET
1,5
COMMENTS
n is prime if and only if a(n) = 2*a(n-1) + n - 2.
LINKS
FORMULA
a(n) = Sum_{k<n} (2^(n mod k) - 1).
G.f.: Sum_{k>=1} ((2^k-2)*z^(2*k+1)+(1-2^k)*z^(2*k)+z^(k+1))/((1-z^k)*(1-z)*(1-2*z)).
EXAMPLE
2^5-1 == 0 (mod 2^1-1), == 1 (mod 2^2-1), == 3 (mod 2^3-1), == 1 (mod 2^4-1), so a(5) = 0+1+3+1 = 5.
MAPLE
f:= proc(n) local k;
add(2^(n mod k) - 1, k=2..n-1)
end proc:
map(f, [$1..100]);
PROG
(Magma) [0] cat [&+[2^(n mod k)-1:k in [1..n-1]]:n in [2..50]]; // Marius A. Burtea, Nov 06 2019
CROSSREFS
Sequence in context: A147685 A353151 A078930 * A344817 A094414 A158867
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Nov 06 2019
STATUS
approved