login
A124259
Smallest k such that n + n^2 + ... + n^k is not squarefree.
2
4, 6, 2, 1, 4, 14, 2, 1, 1, 9, 2, 1, 4, 6, 2, 1, 2, 1, 2, 1, 4, 3, 2, 1, 1, 2, 1, 1, 4, 3, 2, 1, 4, 9, 2, 1, 4, 4, 2, 1, 4, 20, 2, 1, 1, 9, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 4, 5, 2, 1, 4, 2, 1, 1, 4, 25, 2, 1, 4, 4, 2, 1, 4, 2, 1, 1, 4, 7, 2, 1, 1, 4, 2, 1, 4, 6, 2, 1, 2, 1, 2, 1, 4, 9, 2, 1, 2, 1, 1, 1, 4, 20, 2, 1
OFFSET
1,1
LINKS
FORMULA
A124260(n) = Sum_{k=1..a(n)} n^k.
a(A013929(n)) = 1.
EXAMPLE
n=5: 5 = A005117(4),
5 + 5^2 = 30 = 2*3*5 = A005117(19),
5 + 5^2 + 5^3 = 155 = 5*31 = A005117(95),
5 + 5^2 + 5^3 + 5^4 = 780 = (2^2)*3*5*13 not squarefree,
therefore a(5) = 4 and A124260(5) = 780.
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