A263171
Smallest prime starting a sequence of 4 consecutive odd primes such that the center of the symmetrical gaps is 2n.
Original entry on oeis.org
7, 5, 251, 353, 137, 2393, 109, 1931, 1753, 883, 3733, 7351, 12007, 2969, 8887, 27697, 1321, 22811, 38377, 62987, 183823, 15679, 124001, 180563, 45887, 48677, 100847, 178693, 152993, 557087, 34057, 367949, 294551, 134507, 173357, 1802407, 531359, 1134311, 933067
Offset: 1
a(2)=5 because the 4 consecutive primes 5, 7, 11, 13 have gaps 2, 4, 2, which is symmetric about its center 4 = 2*2.
-
with(numtheory):nn:=500000:l:=2:T:=array(1..2*l-1)):
for n from 1 to 35 do:ii:=0:
for k from 1 to nn while(ii=0) do:
lst:={}:lst1:={}:
for m from 1 to 2*l do:
lst:=lst union {ithprime(k+m-1)}
od:
for p from 1 to 2*l do:
lst1:=lst1 union {lst[p]+lst[2*l-p+1]}
od:
n0:=nops(lst1):
if n0=1
then
for a from 1 to 2*l-1 do:
T[a]:=lst[a+1]-lst[a]:
od:
if T[2]=2*n then ii:=1:printf(`%d, `,lst[1]):
else fi :fi:
od :
od:
-
a(n) = {pa = 3; pb = 5; pc = 7; forprime(p=8, , if (((pc-pb) == 2*n) && ((pb-pa) == (p-pc)), return(pa)); pa = pb; pb = pc; pc = p;);} \\ Michel Marcus, Oct 16 2015
A267028
P(n,k) is an array read by rows, with n > 0 and k=1..5, where row n gives the chain of 5 consecutive primes {p(i), p(i+1), p(i+2), p(i+3), p(i+4)} having the symmetrical property p(i) + p(i+4) = p(i+1) + p(i+3) = 2*p(i+2) for some index i.
Original entry on oeis.org
18713, 18719, 18731, 18743, 18749, 25603, 25609, 25621, 25633, 25639, 28051, 28057, 28069, 28081, 28087, 30029, 30047, 30059, 30071, 30089, 31033, 31039, 31051, 31063, 31069, 44711, 44729, 44741, 44753, 44771, 76883, 76907, 76913, 76919, 76943
Offset: 1
The first row is [18713, 18719, 18731, 18743, 18749] because 18713 + 18749 = 18719 + 18743 = 2*18731 = 37462.
The array starts with:
[18713, 18719, 18731, 18743, 18749]
[25603, 25609, 25621, 25633, 25639]
[28051, 28057, 28069, 28081, 28087]
...
-
U:=array(1..50,1..5):W:=array(1..2):kk:=0:
for n from 4 to 10000 do:
for m from 2 by -1 to 1 do:
q:=ithprime(n-m)+ithprime(n+m):W[m]:=q:
od:
if W[1]=W[2] and W[1]=2*ithprime(n) then
kk:=kk+1:U[kk,1]:=ithprime(n-2):
U[kk,2]:=ithprime(n-1):U[kk,3]:=ithprime(n):
U[kk,4]:=ithprime(n+1):U[kk,5]:=ithprime(n+2):
else fi:od:print(U):
for i from 1 to kk do:
for j from i+1 to kk do:
s1:=U[i,1]+U[j,5]:
s2:=U[i,2]+U[j,4]:
s3:=U[i,3]+U[j,3]:
s4:=U[i,4]+U[j,2]:
s5:=U[i,5]+U[j,1]:
if s1=s2 and s2=s3 and s3=s4 and s4=s5
then
printf("%d %d \n",i,j):
else fi:
od:
od:
A353089
Least number which differs from both of its prime neighbors by n^2, and -1 if no such number exists.
Original entry on oeis.org
4, 93, 532, 5607, 31932, 31433, 604122, 3851523, 39175298, 378044079, 367876650, 383204683, 22076314482
Offset: 1
a(1) = 4, because 3 and 5 are the prime neighbors of 4, and 5 - 4 = 4 - 3 = 1 = 1^2 and no number less than 4 differs from both of its prime neighbors by 1^2.
a(2) = 93, because 97 and 89 are the prime neighbors of 93, and 97 - 93 = 93 - 89 = 4 = 2^2 and no number less than 93 differs from both of its prime neighbors by 2^2.
-
a[n_] := a[n] = Module[{diff, diff2, p, q, r},
{diff, diff2, p} = {n*n, 2*n*n, NextPrime[1 + n^2]};
q = NextPrime[p];
r = NextPrime[q];
While[!(q - p == diff2 || (q - p == diff && r - q == diff)),
{p, q, r} = {q, r, NextPrime[r]}];
Return[If[q - p == diff2, Floor[(q + p)/2], q]]];
Table[Print[n, " ", a[n]]; a[n], {n, 1, 10}] (* Jean-François Alcover, Jun 07 2022, after Michael S. Branicky's code *)
-
a(n) = my(k=2); while (((nextprime(k+1)-k) != n^2) || ((k-precprime(k-1)) != n^2), k++); k; \\ Michel Marcus, Jul 10 2022
-
from sympy import nextprime
def a(n):
diff, diff2, p = n*n, 2*n*n, nextprime(1+n**2)
q = nextprime(p)
r = nextprime(q)
while not (q-p == diff2 or (q-p == diff and r-q == diff)):
p, q, r = q, r, nextprime(r)
return (q+p)//2 if q-p == diff2 else q
print([a(n) for n in range(1, 9)]) # Michael S. Branicky, Apr 22 2022
Comments