login
A259111
a(n) = least number k > 1 such that 1^k + 2^k + ... + k^k == n (mod k).
1
2, 4, 2, 8, 2, 3, 2, 16, 2, 4, 2, 3, 2, 4, 2, 32, 2, 3, 2, 5, 2, 4, 2, 3, 2, 4, 2, 7, 2, 3, 2, 64, 2, 4, 2, 3, 2, 4, 2, 5, 2, 3, 2, 8, 2, 4, 2, 3, 2, 4, 2, 8, 2, 3, 2, 7, 2, 4, 2, 3, 2, 4, 2, 128, 2, 3, 2, 8, 2, 4, 2, 3, 2, 4, 2, 8, 2, 3, 2, 5, 2, 4, 2, 3, 2, 4, 2, 11, 2, 3, 2, 8, 2, 4, 2, 3, 2, 4, 2, 5
OFFSET
1,1
LINKS
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