OFFSET
1,1
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..1589
EXAMPLE
MAPLE
A124259 := proc(n)
local k ;
if n =1 then
return 4;
end if;
for k from 1 do
if not numtheory[issqrfree](n*(n^k-1)/(n-1)) then
return k;
end if
end do:
end proc:
seq(A124259(n), n=1..40) ; # R. J. Mathar, Jan 13 2021
MATHEMATICA
a[n_] := Module[{k = 1, s = n}, While[SquareFreeQ[s], k++; s += n^k]; k]; Array[a, 100] (* Amiram Eldar, Dec 26 2020 *)
PROG
(PARI) a(n) = my(k=1); while (issquarefree(sum(i=1, k, n^i)), k++); k; \\ Michel Marcus, Dec 26 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Oct 23 2006
EXTENSIONS
Data corrected by Amiram Eldar, Dec 26 2020
STATUS
approved