A081416 Duplicate of A051795.
18731, 25621, 28069, 30059, 31051, 44741, 76913, 97441, 103669, 106681, 118831
Offset: 1
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.
5 belongs to the sequence because 5 = (3 + 7)/2. Likewise 53 = (47 + 59)/2. 5 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (3, 5, 7). 53 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (47, 53, 59). 257 and 263 belong to the sequence because they are terms, but not first or last, of the AP of consecutive primes (251, 257, 263, 269).
a006562 n = a006562_list !! (n-1) a006562_list = filter ((== 1) . a010051) a075540_list -- Reinhard Zumkeller, Jan 20 2012
a006562 n = a006562_list !! (n-1) a006562_list = h a000040_list where h (p:qs@(q:r:ps)) = if 2 * q == (p + r) then q : h qs else h qs -- Reinhard Zumkeller, May 09 2013
[a: n in [1..1000] | IsPrime(a) where a is NthPrime(n)-NthPrime(n+1)+NthPrime(n+2)]; // Vincenzo Librandi, Jun 23 2016
Transpose[ Select[ Partition[ Prime[ Range[1000]], 3, 1], #[[2]] ==(#[[1]] + #[[3]])/2 &]][[2]] p=Prime[Range[1000]]; p[[Flatten[1+Position[Differences[p, 2], 0]]]] Prime[#]&/@SequencePosition[Differences[Prime[Range[800]]],{x_,x_}][[All,2]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 31 2019 *)
betwixtpr(n) = { local(c1,c2,x,y); for(x=2,n, c1=c2=0; for(y=prime(x-1)+1,prime(x)-1, if(!isprime(y),c1++); ); for(y=prime(x)+1,prime(x+1)-1, if(!isprime(y),c2++); ); if(c1==c2,print1(prime(x)",")) ) } \\ Cino Hilliard, Jan 25 2005
forprime(p=1,999, p-precprime(n-1)==nextprime(p+1)-p && print1(p",")) \\ M. F. Hasler, Jun 01 2013
is(n)=n-precprime(n-1)==nextprime(n+1)-n && isprime(n) \\ Charles R Greathouse IV, Apr 07 2016
from sympy import nextprime; p, q, r = 2, 3, 5 while q < 6000: if 2*q == p + r: print(q, end = ", ") p, q, r = q, r, nextprime(r) # Ya-Ping Lu, Dec 23 2021
In 5-tuple of consecutive primes (18713, 18719, 18731, 18743, 18749), the primes are symmetric w.r.t. its central prime 18731, since 18713+18749 = 18719+18743 = 2*18731, and this is the smallest such 5-tuple. Hence, a(2)=18731. Alternatively, the symmetry can be seen from the differences between consecutive primes. For (18713, 18719, 18731, 18743, 18749), the differences are (6,12,12,6).
Table[i = n + 2; While[x = Differences[Table[Prime[k + i], {k, -n, n}]]; x != Reverse[x], i++]; Prime[i], {n, 3}] (* Robert Price, Oct 12 2019 *)
p = 79 = (71 + 73 + 79 + 83 + 89)/5 = 395/5 i.e. it is both the arithmetic mean and median.
Do[s3=Prime[n]+Prime[n+1]+Prime[n+2]; s5=Prime[n-1]+s3+Prime[n+3]; If[Equal[s5/5, Prime[n+1]], Print[Prime[n+1]]], {n, 3, 3000}] Select[Partition[Prime[Range[1500]],5,1],Mean[#]==#[[3]]&][[All,3]] (* Harvey P. Dale, Nov 04 2019 *)
p=2;q=3;r=5;s=7;forprime(t=11,1e9,if(p+q+s+t==4*r,print1(r", ")); p=q; q=r; r=s; s=t) \\ Charles R Greathouse IV, Nov 20 2012
p = 491 = (463 + 467 + 479 + 487 + 491 + 499 + 503 + 509 + 521)/9 = 4419/9.
P:=Filtered([1..50000],IsPrime);; a:=List(Filtered(List([0..3000],k->List([5..13],j->P[j-4+k])), i-> Sum(i)/9=i[5]),m->m[5]); # Muniru A Asiru, Feb 14 2018
Do[s3=Prime[n]+Prime[n+1]+Prime[n+2]; s5=Prime[n-1]+s3+Prime[n+3]; s7=Prime[n-2]+s5+Prime[n+4]; s9=Prime[n-3]+s7+Prime[n+5]; If[Equal[s9/9, Prime[n+1]], Print[Prime[n+1]]], {n, 4, 10000}] (* Second program: *) With[{k = 4}, Select[MapIndexed[{Prime[First@ #2 + k], #1} &, Mean /@ Partition[Prime@ Range[3000], 2 k + 1, 1]], SameQ @@ # &][[All, 1]]] (* Michael De Vlieger, Feb 15 2018 *) Select[Partition[Prime[Range[3000]],9,1],Mean[#]==#[[5]]&][[;;,5]] (* Harvey P. Dale, Mar 09 2023 *)
isok(p) = {if (isprime(p), k = primepi(p); if (k > 4, sum(i=k-4, k+4, prime(i)) == 9*p;););} \\ Michel Marcus, Mar 07 2018
p = 53 = (41 + 43 + 47 + 53 + 59 + 61 + 67)/7 = 371/7 i.e. it is the arithmetic mean.
P:=Filtered([1..10000],IsPrime);; a:=List(Filtered(List([0..1000],k->List([4..10],j->P[j-3+k])), i-> Sum(i)/7=i[4]),m->m[4]); # Muniru A Asiru, Feb 14 2018
Do[s3=Prime[n]+Prime[n+1]+Prime[n+2]; s5=Prime[n-1]+s3+Prime[n+3]; s7=Prime[n-2]+s5+Prime[n+4]; If[Equal[s7/7, Prime[n+1]], Print[Prime[n+1]]], {n, 3, 5000}] (* Second program: *) With[{k = 3}, Select[MapIndexed[{Prime[First@ #2 + k], #1} &, Mean /@ Partition[Prime@ Range[10^3], 2 k + 1, 1]], SameQ @@ # &][[All, 1]]] (* Michael De Vlieger, Feb 15 2018 *) Select[Partition[Prime[Range[1500]],7,1],Mean[#]==#[[4]]&][[All,4]] (* Harvey P. Dale, Jul 01 2022 *)
isok(p) = {if (isprime(p), k = primepi(p); if (k > 3, sum(i=k-3, k+3, prime(i)) == 7*p;););} \\ Michel Marcus, Mar 07 2018
A175309[n_] := Module[{k}, k = 1; While[! AllTrue[Range[n], Prime[k+#] - Prime[k+#-1] == Prime[n+k+1-#] - Prime[n+k-#] &], k++]; Return[Prime[k]]]; Table[A175309[n], {n, 1, 7}] (* Robert Price, Mar 27 2019 *)
a(n)={ my( last=vector(n++,i,prime(i)), m, i=Mod(n-2,n)); forprime(p=last[n],default(primelimit), m=last[1+lift(i+2)]+last[1+lift(i++)]=p; for( j=1,n\2, last[1+lift(i-j)]+last[1+lift(i+j+1)]==m || next(2)); return( last[1+lift(i+1)])) } \\ M. F. Hasler, Apr 02 2010
isok(p, n) = {my(k=primepi(p)); for (j=1, n, if (prime(k+j) - prime(k+j-1) != prime(n+k+1-j) - prime(n+k-j), return (0));); return (1);} \\ Michel Marcus, Apr 08 2017
For n = 1, prime(1) + prime(2) = 2 + 3 = 5; "prime(0)" does not exist, so a(1) = 0. For n = 4: j = 0: prime(4) + prime(5) = 7 + 11 = 18; j = 1: prime(3) + prime(6) = 5 + 13 = 18; j = 2: prime(2) + prime(7) = 3 + 17 = 20 != 18, so a(4) = 1. For n = 5: j = 0: prime(5) + prime(6) = 11 + 13 = 24; j = 1: prime(4) + prime(7) = 7 + 17 = 24; j = 2: prime(3) + prime(8) = 5 + 19 = 24; j = 3: prime(2) + prime(9) = 3 + 23 = 26 != 24, so a(5) = 2.
import sympy offset = 1 N = 100 l = [] for n in range(offset,N+1): j = 0 first_sum = sympy.prime(n-j)+sympy.prime(n+j+1) while (n-j) > 1: j += 1 sum = sympy.prime(n-j)+sympy.prime(n+j+1) if sum != first_sum: break l.append(max(0,j-1)) print(l)
p = 683383: 683747 + ... + p + ... + 683819 = 7p; 683759 + ... + p + ... + 683807 = 5p; 683777 + p + 683789 = 3p.
P:=Filtered([1,3..3*10^7+1],IsPrime);; a:=Intersection(List([1,2,3],b->List(Filtered(List([0..Length(P)-(2*b+1)],k->List([1..2*b+1],j->P[j+k])),i->Sum(i)/(2*b+1)=i[b+1]),m->m[b+1]))); # Muniru A Asiru, Apr 08 2018
a = {}; Do[p = 2Prime[n]; If[p == Prime[n - 1] + Prime[n + 1] && p == Prime[n - 2] + Prime[n + 2] && p == Prime[n - 3] + Prime[n + 3], Print[p / 2]; AppendTo[a, p / 2]], {n, 5, 1100000}]; a (* Robert G. Wilson v, Jun 28 2004 *) Transpose[Select[Partition[Prime[Range[1620000]],7,1],(#[[1]]+#[[7]])/2 == (#[[2]]+#[[6]])/2==(#[[3]]+#[[5]])/2==#[[4]]&]][[4]] (* Harvey P. Dale, Sep 13 2013 *)
from sympy import nextprime; p, q, r, s, t, u, v = 2, 3, 5, 7, 11, 13, 17 while v < 29000000: if p + v == q + u == r + t == 2*s: print(s, end = ', ') p, q, r, s, t, u, v = q, r, s, t, u, v, nextprime(v) # Ya-Ping Lu, May 11 2024
a(1) = 5 = (3 + 5 + 7)/3 = 15/3. a(5) = 53 = (31 + 37 + 41 + 43 + 47 + 53 + 59 + 61 + 67 + 71 + 73)/11 = 583/11. a(6) = 71 = (43 + 47 + 53 + 59 + 61 + 67 + 71 + 73 + 79 + 83 + 89 + 97 + 101)/13 = 923/13.
f[n_] := Block[{p = Prime@ Range[2n +1]}, While[ Total[p] != (2n +1) p[[n +1]], p = Join[Rest@ p, {NextPrime[ p[[-1]]] }]]; p[[n +1]]]; Array[f, 46, 0] (* Robert G. Wilson v, Jun 21 2004 and modified Apr 11 2017 *)
for(n=0, 50, i=2*n+1;f=0;forprime(p=2, 10^7, s=0;c=i;pr=p-1;t=0;while(c>0, c=c-1;pr=nextprime(pr+1);s=s+pr; if(c==(i-1)/2, t=pr)); if(s/i==t, print1(t", ");f=1;break)); if(!f, print1("0, ")))
Comments