cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A124259 Smallest k such that n + n^2 + ... + n^k is not squarefree.

This page as a plain text file.
%I A124259 #15 Jan 13 2021 04:20:42
%S A124259 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,
%T A124259 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,
%U A124259 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
%N A124259 Smallest k such that n + n^2 + ... + n^k is not squarefree.
%H A124259 Amiram Eldar, <a href="/A124259/b124259.txt">Table of n, a(n) for n = 1..1589</a>
%F A124259 A124260(n) = Sum_{k=1..a(n)} n^k.
%F A124259 a(A013929(n)) = 1.
%e A124259 n=5: 5 = A005117(4),
%e A124259 5 + 5^2 = 30 = 2*3*5 = A005117(19),
%e A124259 5 + 5^2 + 5^3 = 155 = 5*31 = A005117(95),
%e A124259 5 + 5^2 + 5^3 + 5^4 = 780 = (2^2)*3*5*13 not squarefree,
%e A124259 therefore a(5) = 4 and A124260(5) = 780.
%p A124259 A124259 := proc(n)
%p A124259     local k ;
%p A124259     if n =1 then
%p A124259         return 4;
%p A124259     end if;
%p A124259     for k from 1 do
%p A124259         if not numtheory[issqrfree](n*(n^k-1)/(n-1)) then
%p A124259             return  k;
%p A124259         end if
%p A124259     end do:
%p A124259 end proc:
%p A124259 seq(A124259(n),n=1..40) ; # _R. J. Mathar_, Jan 13 2021
%t A124259 a[n_] := Module[{k = 1, s = n}, While[SquareFreeQ[s], k++; s += n^k]; k]; Array[a, 100] (* _Amiram Eldar_, Dec 26 2020  *)
%o A124259 (PARI) a(n) = my(k=1); while (issquarefree(sum(i=1, k, n^i)), k++); k; \\ _Michel Marcus_, Dec 26 2020
%Y A124259 Cf. A005117, A013929, A124260.
%K A124259 nonn
%O A124259 1,1
%A A124259 _Reinhard Zumkeller_, Oct 23 2006
%E A124259 Data corrected by _Amiram Eldar_, Dec 26 2020