OFFSET
1,2
COMMENTS
a(n) divides n * A007947(n).
FORMULA
EXAMPLE
a(2) = 4 because, for every positive integer k, (k+1)^2 + (k+2)^2 + (k+3)^2 + (k+4)^2 == 0 (mod 2), and no smaller positive integer satisfies this condition.
MATHEMATICA
sum[n_, r_] := Mod[Sum[k^r, {k, 1, n}], r];
rad[r_] := Product[i[[1]], {i, FactorInteger[r]}];
seq[r_] := Table[sum[n, r], {n, 1, r*rad[r]}];
A354139[r_] := Piecewise[ { {rad[r], OddQ[r]},
{2*r, EvenQ[r] && PrimePowerQ[r]},
{Length[FindRepeat[seq[r]]], EvenQ[r] && Not[PrimePowerQ[r]]}
}
];
Table[A354139[r], {r, 1, 20}] (* Improved by Dimitrios T. Tambakos, Feb 08 2023 *)
PROG
(PARI) isok(k, n) = my(p=sum(i=1, k, Mod(i+x, n)^n)); if (p==0, return(1)); for (i=1, n, if (subst(p, x, i) != 0, return(0))); return(1);
a(n) = my(k=1); while (!isok(k, n), k++); k; \\ Michel Marcus, May 21 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Dimitrios T. Tambakos, May 18 2022
STATUS
approved