A259111 a(n) = least number k > 1 such that 1^k + 2^k + ... + k^k == n (mod k).
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
Keywords
Examples
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)
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..8192
Programs
-
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 *)
-
PARI
vector(100,n,k=2;while(sum(i=1,k,i^k)!=Mod(n,k),k++);k)
Formula
a(2^n) = 2^(n+1) for n >= 0.