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.

A238849 Smallest k such that k*n^3 - 1 and k*n^3 + 1 are twin primes.

Original entry on oeis.org

4, 9, 4, 3, 24, 2, 24, 30, 58, 3, 12, 19, 96, 3, 10, 165, 114, 11, 390, 159, 2, 30, 114, 10, 18, 12, 24, 6, 42, 19, 72, 24, 30, 72, 24, 3, 150, 189, 40, 54, 348, 5, 24, 93, 14, 33, 324, 9, 150, 81, 70, 39, 354, 3, 138, 42, 56, 51, 180, 16, 18, 9
Offset: 1

Views

Author

Derek Orr, Mar 06 2014

Keywords

Examples

			a(1) = 4 because for k = 1, 1*(1^3) - 1 = 0 and 1*(1^3) + 1 = 2 are not twin primes, for k = 2, 1 and 3 are not twin primes, for k = 3, 2 and 4 are not twin primes, so the smallest k that works is k = 4: 4*(1^3) - 1 = 3 and 4*(1^3) + 1 = 5 are twin primes.
		

Crossrefs

Programs

  • Python
    import sympy
    from sympy import isprime
    def f(n):
      for k in range(1,10**4):
        if isprime(k*(n**3)-1) and isprime(k*(n**3)+1):
          return k
    n = 1
    while n < 10**3:
      print(f(n))
      n += 1
Showing 1-1 of 1 results.