A124259 Smallest k such that n + n^2 + ... + n^k is not squarefree.
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
Keywords
Examples
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.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..1589
Programs
-
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 *)
-
PARI
a(n) = my(k=1); while (issquarefree(sum(i=1, k, n^i)), k++); k; \\ Michel Marcus, Dec 26 2020
Extensions
Data corrected by Amiram Eldar, Dec 26 2020