OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..8192
FORMULA
a(2^n) = 2^(n+1) for n >= 0.
EXAMPLE
Consider n=2:
Is k=2? 1^2 + 2^2 == 1 (mod 2). No.
Is k=3? 1^3 + 2^3 + 3^3 == 0 (mod 3). No.
Is k=4? 1^4 + 2^4 + 3^4 + 4^4 == 2 (mod 4). Yes. So a(2) = 4.
(Example corrected by N. J. A. Sloane, Jul 02 2019)
MAPLE
a:= proc(n) local k; for k from 2 while
add(i&^k mod k, i=1..k) mod k <> n mod k do od; k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jun 18 2015
MATHEMATICA
lnk[n_]:=Module[{k=2}, While[Mod[Total[Range[k]^k], k]!=Mod[n, k], k++]; k]; Array[ lnk, 100] (* Harvey P. Dale, Jul 02 2019 *)
PROG
(PARI) vector(100, n, k=2; while(sum(i=1, k, i^k)!=Mod(n, k), k++); k)
CROSSREFS
KEYWORD
nonn
AUTHOR
Derek Orr, Jun 18 2015
STATUS
approved