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.

Showing 1-1 of 1 results.

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

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 23 2006

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.
		

Crossrefs

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

Formula

A124260(n) = Sum_{k=1..a(n)} n^k.
a(A013929(n)) = 1.

Extensions

Data corrected by Amiram Eldar, Dec 26 2020
Showing 1-1 of 1 results.