login
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.
2
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,2
COMMENTS
Smallest k such that A103689(k) = n.
a(85) > 10^9 (unless a(85) = 0).
LINKS
Pontus von Brömssen, Table of n, a(n) for n = 1..84
EXAMPLE
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.
PROG
(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
(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
CROSSREFS
Cf. A103689.
Sequence in context: A340883 A109625 A266290 * A222903 A024069 A295407
KEYWORD
nonn
AUTHOR
STATUS
approved