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.

A348347 Smallest k such that in the pairs of numbers j*k +- 1, none is prime for 1 <= j < n but at least one is prime for j = n; or 0 if no such k exists.

Original entry on oeis.org

1, 5, 92, 13, 208, 47, 512, 149, 1688, 145, 6686, 539, 4106, 757, 9970, 1217, 16012, 881, 56194, 2441, 53576, 3343, 111992, 2917, 152734, 2053, 49376, 6791, 839522, 4985, 114118, 30097, 567302, 17209, 493618, 33613, 991976, 28097, 758932, 91099, 1898368, 36271
Offset: 1

Views

Author

Pontus von Brömssen, Oct 13 2021

Keywords

Comments

Smallest k such that A103689(k) = n.
a(85) > 10^9 (unless a(85) = 0).

Examples

			a(3) = 92 because none of 92 +- 1 and 2*92 +- 1 are prime but 3*92 + 1 is prime; and for k < 92, either 3*k +- 1 are also both not prime, or some j*k +- 1 is prime for j < 3.
		

Crossrefs

Cf. A103689.

Programs

  • PARI
    f(n) = my(k=1); while (!isprime(k*n+1) && !isprime(k*n-1), k++); k; \\ A103689
    a(n) = my(k=1); while (f(k) != n, k++); k; \\ Michel Marcus, Oct 18 2021
  • Python
    from sympy import isprime
    def A348347(n):
        k = 1
        while 1:
            m = 1
            while m <= n and not (isprime(m*k-1) or isprime(m*k+1)): m += 1
            if m == n: return k
            k += 1