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.

A339008 Least k such that p = k^2 + 1 and q = (k+2n)^2 + 1 are two consecutive prime numbers of the same form with q - p square.

This page as a plain text file.
%I A339008 #25 Apr 04 2024 09:50:11
%S A339008 24,6,312984,16896,240,734994,10640,10360,1946016,2550,13189264,72996,
%T A339008 416520,2184336,1584360,202484,232696,1700150,2394456,375360,8736504,
%U A339008 9237866,53629744,360126,87000,574339974,82404216,23237760,1249877496,826650,127119344,1527720
%N A339008 Least k such that p = k^2 + 1 and q = (k+2n)^2 + 1 are two consecutive prime numbers of the same form with q - p square.
%C A339008 4*n*(k + n) is a square. If n is a square, then k + n is also a square.
%C A339008 If n is prime, then n divides k.
%C A339008 a(n) = A339007(n) for n = 1, 2, 3, 4, 6, 7 and 9.
%H A339008 Chai Wah Wu, <a href="/A339008/b339008.txt">Table of n, a(n) for n = 1..60</a>
%e A339008 a(1) = 24 because 24^2 + 1 = 577, (24 + 2)^2 + 1 = 677. The numbers 577 and 677 are two consecutive primes of the form m^2+1, and 677 - 577 = 10^2 is a square. The other values m such that p = m^2 + 1 and q = (m+2)^2 + 1 are consecutive primes with q - p square are 11024, 133224, 156024, 342224, 416024, ...
%e A339008 a(2) = 6 because 6^2 + 1 = 37, (6 + 4)^2 + 1 = 101. The numbers 37 and 101 are two consecutive primes of the form m^2+1, and 101 - 37 = 8^2 is a square. The other values m such that p = m^2 + 1 and q = (m+4)^2 + 1 are consecutive primes with q - p square are 16, 126, 1350, 1456, 1566, 2310, 5200, ...
%p A339008 for n from 1 to 25 do:
%p A339008 ii:=0:n1:=0:q:=2:
%p A339008   for k from 2 by 2 to 10^9 while(ii=0) do:
%p A339008     p:=k^2+1:
%p A339008    if isprime(p)
%p A339008     then
%p A339008      x:=p-q:q:=p:z:=sqrt(x):
%p A339008       if z=floor(z) and k-n1=2*n
%p A339008        then
%p A339008         ii:=1:printf(`%d %d \n`,n,n1):
%p A339008          else
%p A339008          n1:=k:
%p A339008        fi:
%p A339008     fi:
%p A339008   od:
%p A339008 od:
%o A339008 (PARI) consecutive(p, q) = {forprime(r = nextprime(p+1), precprime(q-1), if (isprime(r) && issquare(r-1), return(0));); return(1);}
%o A339008 a(n) = my(k=1); while (!(isprime(p=k^2+1) && isprime(q=(k+2*n)^2 + 1) && issquare(q-p) && consecutive(p, q)), k++); k; \\ _Michel Marcus_, Nov 30 2020
%Y A339008 Cf. A002496, A096012, A193558, A206328, A216330, A339007.
%K A339008 nonn
%O A339008 1,1
%A A339008 _Michel Lagneau_, Nov 18 2020
%E A339008 a(26)-a(32) from _Chai Wah Wu_, Dec 06 2020