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.

A238848 Smallest k such that k*n^3 - 1 is prime.

Original entry on oeis.org

3, 1, 2, 2, 4, 2, 14, 7, 6, 2, 4, 4, 14, 3, 4, 2, 16, 4, 12, 9, 2, 5, 16, 2, 2, 3, 16, 6, 10, 4, 2, 4, 22, 2, 6, 3, 6, 10, 6, 3, 22, 5, 2, 3, 4, 2, 18, 4, 26, 10, 4, 5, 6, 2, 2, 7, 6, 2, 10, 5, 2, 9, 4, 2, 16, 3, 6, 9, 2, 3, 30, 5, 14, 6, 24, 5, 16, 5
Offset: 1

Views

Author

Derek Orr, Mar 06 2014

Keywords

Examples

			a(1) = 3 because for k = 1, 1*(1^3) - 1 = 0 is not prime, for k = 2, 2*(1^3) - 1 = 1 is not prime, but for k = 3, 3*(1^3) - 1 = 2 is prime.
		

Crossrefs

Programs

  • Mathematica
    sk[n_]:=Module[{k=1,n3=n^3},While[!PrimeQ[k*n3-1],k++];k]; Array[sk,80] (* Harvey P. Dale, Jan 04 2023 *)
  • Python
    import sympy
    from sympy import isprime
    def f(n):
      for k in range(1,10**3):
        if isprime(k*(n**3)-1):
          return k
    n = 1
    while n < 10**3:
      print(f(n))
      n += 1