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.

A239020 Smallest number k such that k*n +/- 1 and k*n^2 +/- 1 are two sets of twin primes. a(n) = 0 if no such number exists.

This page as a plain text file.
%I A239020 #25 Nov 07 2024 21:55:20
%S A239020 4,3,2,15,6,2,150,75,20,6,78,85,2490,30,18,195,5160,490,330,12,2,870,
%T A239020 330,13,42,105,2280,375,12,41,1632,720,90,3,216,2,1380,615,98,84,438,
%U A239020 65,600,210,148,735,3870,115,138,39,182,2715,16590,48,60,63,210,120
%N A239020 Smallest number k such that k*n +/- 1 and k*n^2 +/- 1 are two sets of twin primes. a(n) = 0 if no such number exists.
%C A239020 If n>3 is odd and not a multiple of 3, then a(n) is a multiple of 6; e.g., a(5) = 6, a(7) = 150, a(11) = 78. If n>3 is even and not a multiple of 3, then a(n) is a multiple of 3. In short, for n>1, k*n should be a multiple of 6. - _Zak Seidov_, Mar 13 2014
%e A239020 1*2 +/- 1 (1 and 3) and 1*2^2 +/- 1 (3 and 5) are not two sets of twin primes. 2*2 +/- 1 (3 and 5) and 2*2^2 +/- 1 (7 and 9) are not two sets of twin primes. However, 3*2 +/- 1 (5 and 7) and 3*2^2 +/- 1 (11 and 13) are two sets of twin primes. Thus, a(2) = 3.
%o A239020 (Python)
%o A239020 from sympy import isprime
%o A239020 def b(n):
%o A239020   for k in range(10**5):
%o A239020     if isprime(k*n+1) and isprime(k*n-1) and isprime(k*(n**2)+1) and isprime(k*(n**2)-1):
%o A239020       return k
%o A239020 n = 1
%o A239020 while n < 100:
%o A239020   print(b(n))
%o A239020   n += 1
%o A239020 (PARI) a(n) = {k = 1; while (! (isprime(k*n+1) && isprime(k*n-1) && isprime(k*n^2+1) && isprime(k*n^2-1)), k++); k;} \\ _Michel Marcus_, Mar 15 2014
%Y A239020 Cf. A231819, A053989, A035092, A034693.
%K A239020 nonn
%O A239020 1,1
%A A239020 _Derek Orr_, Mar 09 2014