OFFSET
1,2
COMMENTS
If n is an odd prime, a(n) = 3, and the solutions are x = 0, 1, and -1. For n = 2, the solutions are the same, but a(n) = 2 since 1 and -1 are equal (mod 2). - Michael B. Porter, Jul 08 2016
The set of solutions is independent of the choice of k. - Michael B. Porter, Jul 08 2016
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Michael De Vlieger)
Steven R. Finch, Idempotents and Nilpotents Modulo n, arXiv:math/0605019 [math.NT], 2006-2017.
FORMULA
a(n) = Sum_{k=1..n} floor((k^(n+2)-k^n)/n)-floor((k^(n+2)-k^n -1)/n). - Anthony Browne, Jul 06 2016
Multiplicative with a(2^e) = 2^e for e < 3 and 2^(e-1) + 4 for e >= 3, and a(p^e) = p^(e-1) + 2 for p > 2. - Amiram Eldar, Sep 08 2020
EXAMPLE
For n = 10, using k = 1, the solutions are x = 0, 1, 4, 5, 6, and 9, so a(10) = 6. - Michael B. Porter, Jul 08 2016
MATHEMATICA
Table[Sum[Floor[(k^(n + 2) - k^n)/n] - Floor[(k^(n + 2) - k^n - 1)/n], {k, n}], {n, 75}] (* Michael De Vlieger, Jul 07 2016 *)
f[2, e_] := If[e < 3, 2^e, 2^(e - 1) + 4]; f[p_, e_] := p^(e - 1) + 2; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 08 2020 *)
PROG
(PARI) a(n) = sum(k=1, n, (k^(n+2)-k^n)\n - (k^(n+2)-k^n -1)\n); \\ Michel Marcus, Jul 07 2016
CROSSREFS
KEYWORD
mult,nonn
AUTHOR
Steven Finch, Apr 11 2006
STATUS
approved