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.

Showing 1-6 of 6 results.

A163846 Starting from a(1)=5, a(n+1) is the smallest prime > a(n) such that 2*a(n)-a(n+1) is also prime.

Original entry on oeis.org

5, 7, 11, 17, 23, 29, 41, 53, 59, 71, 83, 107, 113, 137, 167, 197, 227, 257, 263, 269, 281, 293, 317, 353, 359, 401, 419, 449, 467, 491, 503, 557, 593, 599, 641, 683, 719, 761, 821, 881, 941, 953, 977, 983, 1013, 1049, 1151, 1193, 1223, 1229, 1277, 1361, 1433
Offset: 1

Views

Author

Keywords

Comments

This is: select the smallest prime a(n+1) = a(n)+d such that at a(n)-d is another prime at the same distance to but at the opposite side of a(n).
From Zhi-Wei Sun, Feb 25 2013: (Start)
By induction, a(n)==2 (mod 3) for all n>2.
For a prime p>3 define g(p) as the least prime q>p such that 2p-q is also prime. Construct a simple (undirected) graph G as follows: The vertex set is the set of all primes greater than 3, and there is an edge connecting the vertices p and q>p if and only if g(p)=q.
Conjecture: The graph G constructed above consists of exactly two trees: one containing 7 and all odd primes congruent to 2 modulo 3, and another one containing all primes congruent to 1 modulo 3 except 7. (End)

Examples

			The first candidate for a(2) is the prime 5+2=7, which is selected since 5-2=3 is also prime.
The first candidate for a(3) is the prime 7+4=11, which is selected since 7-4=3 is also prime.
The first candidate for a(4) is the prime 11+2=13, which is not selected since 11-2=9 is composite.
The second candidate for a(4) is the prime 11+4=17, which is selected since 11-4=7 is prime.
		

Crossrefs

Programs

  • Mathematica
    DeltaPrimePrevNext[n_]:=Module[{d, k1, k2}, k1=n-1; k2=n+1; While[ !PrimeQ[k1] || !PrimeQ[k2], k2++; k1-- ]; d=k2-n]; lst={}; p=5; Do[If[p-DeltaPrimePrevNext[p]>1, AppendTo[lst, p]; p=p+DeltaPrimePrevNext[p]], {n,6!}]; lst
    k=3
    n=1
    Do[If[m==3, Print[n, " ", 5]]; If[m==k, n=n+1; Do[If[PrimeQ[2Prime[m]-Prime[j]]==True, k=j; Print[n, " ", Prime[j]]; Goto[aa]], {j, m+1, PrimePi[2Prime[m]]}]]; Label[aa]; Continue, {m, 3, 1000}] (* Zhi-Wei Sun, Feb 25 2013 *)
    np[n_]:=Module[{nxt=NextPrime[n]},While[!PrimeQ[2n-nxt],nxt=NextPrime[nxt]]; nxt]; NestList[np, 5, 60] (* Harvey P. Dale, Feb 28 2013 *)

Extensions

Edited by R. J. Mathar, Aug 29 2009

A163847 Starting from a(1)=13, a(n+1) is the smallest prime > a(n) such that 2*a(n) - a(n+1) is also prime.

Original entry on oeis.org

13, 19, 31, 43, 67, 73, 79, 97, 127, 151, 163, 199, 241, 271, 313, 349, 367, 397, 421, 433, 457, 541, 619, 631, 643, 673, 727, 811, 853, 877, 967, 997, 1087, 1123, 1129, 1171, 1213, 1297, 1303, 1327, 1423, 1447, 1471, 1483, 1543, 1597, 1627, 1657, 1693
Offset: 1

Views

Author

Keywords

Comments

This is: select the prime a(n+1) = a(n)+d such that at a(n)-d is another prime at the same distance to but at the opposite side of a(n).
It seems all these primes are in the class 1 (mod 6), that is, in A002476 as opposed to A007528.

Examples

			For a(2), the first candidate is the prime 17=13+4, which is not selected because 13-4=9 is not prime.
The next larger candidate is the prime 13+6=19, which is selected as a(2) because 13-6=7 is also prime.
For a(3) the first candidate is the prime 19+4=23, which is not selected because 19-4=15 is not prime.
The next candidate is the prime 19+10=29, which is not selected because the 19-10=9 is not prime.
The next larger candidate, the prime 19+12=31 is selected as a(3), because 19-12=7 is prime.
		

Crossrefs

Programs

  • Maple
    A163847 := proc(n) option remember; if n = 1 then 13; else for a from procname(n-1)+2 by 2 do if isprime(a) and isprime( 2*procname(n-1)-a) then RETURN(a) ; fi; od: fi; end:
    seq(A163847(n),n=1..80) ; # R. J. Mathar, Aug 29 2009
  • Mathematica
    DeltaPrimePrevNext[n_]:=Module[{d, k1, k2}, k1=n-1; k2=n+1; While[ !PrimeQ[k1] || !PrimeQ[k2], k2++; k1-- ]; d=k2-n]; lst13={}; p=13; Do[If[p-DeltaPrimePrevNext[p]>1, AppendTo[lst13, p]; p=p+DeltaPrimePrevNext[p]],{n, 7!}]; lst13
    (* Second program: *)
    k=6
    n=1
    Do[If[m==6, Print[n, " ", 13]]; If[m==k, n=n+1; Do[If[PrimeQ[2Prime[m]-Prime[j]]==True, k=j; Print[n, " ", Prime[j]]; Goto[aa]], {j, m+1, PrimePi[2Prime[m]]}]]; Label[aa]; Continue, {m, 6, 1000}] (* Zhi-Wei Sun, Feb 25 2013 *)
    sp[p_]:=Module[{p1=NextPrime[p]},While[!PrimeQ[2p-p1],p1=NextPrime[p1]];p1]; NestList[ sp,13,50] (* Harvey P. Dale, Aug 09 2023 *)
  • PARI
    first(n) = { my(res = vector(n)); res[1] = 13; for(x=2, n, forprime(p=res[x-1]+1, , if(ispseudoprime(2*res[x-1] - p), res[x]=p; break()))); res; } \\ Iain Fox, Nov 18 2017

Extensions

Definition and comment rephrased by R. J. Mathar, Aug 29 2009

A222566 a(1)=2; for n>0, a(n+1) is the least prime p>a(n) such that 2*(a(n)+1)-p is prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 41, 43, 47, 53, 61, 71, 73, 89, 97, 107, 109, 113, 127, 149, 151, 167, 173, 181, 191, 193, 197, 199, 227, 229, 233, 239, 241, 251, 263, 271, 281, 283, 311, 313, 317, 353, 359, 367, 383, 389, 397, 443, 449, 457, 467, 479, 499, 509, 521, 523, 557, 569, 571, 587, 599, 601, 617, 619, 641, 643, 647, 653, 661, 677, 683, 691, 701, 727, 773, 787, 857, 859, 863, 907, 929, 941, 947, 967, 983, 991, 1013, 1019, 1021, 1031, 1033, 1049, 1051, 1091, 1093
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 25 2013

Keywords

Comments

For a prime p define g(p) as the least prime q>p such that 2*(p+1)-q is prime. Construct a simple (undirected) graph G as follows: The vertex set of G is the set of all primes, and for the vertices p and q>p there is an edge connecting p and q if and only if g(p)=q. Clearly G contains no cycle.
Conjecture: The graph G constructed above is connected and hence it is a tree!

Examples

			a(2)=3 since 2(2+1)=3+3, and a(3)=5 since 2(3+1)=5+3.
		

Crossrefs

Programs

  • Mathematica
    k=1
    n=1
    Do[If[m==1,Print[n," ",2]];If[m==k,n=n+1;Do[If[PrimeQ[2(Prime[m]+1)-Prime[j]]==True,k=j;Print[n," ",Prime[j]];Goto[aa]],{j,m+1,PrimePi[2Prime[m]]}]];
    Label[aa];Continue,{m,1,1000}]

A222603 a(1)=1; for n>0, a(n+1) is the least practical number q>a(n) such that 2(a(n)+1)-q is practical.

Original entry on oeis.org

1, 2, 4, 6, 8, 12, 18, 20, 24, 30, 32, 36, 42, 54, 56, 60, 66, 78, 80, 84, 90, 104, 120, 162, 176, 192, 210, 224, 234, 260, 270, 272, 276, 294, 320, 330, 342, 378, 380, 384, 390, 392, 396, 414, 416, 420, 450, 462, 464, 468, 476, 486, 510, 512, 522, 546, 594, 620, 630, 702, 704, 714, 726, 728, 744, 750, 798, 800, 810, 812, 816, 920, 924, 930, 966, 968, 972, 980, 990, 992, 1014, 1040, 1050, 1088, 1122, 1232, 1242, 1254, 1280, 1290, 1302, 1316, 1332, 1350, 1352, 1380, 1386, 1458, 1518, 1520
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 26 2013

Keywords

Comments

By a result of Melfi, each positive even number can be written as the sum of two practical numbers.
For a practical number p, define h(p) as the least practical number q>p such that 2(p+1)-q is practical. Construct a simple (undirected) graph H as follows: The vertex set of H is the set of all practical numbers, and for two vertices p and q>p there is an edge connecting p and q if and only if h(p)=q. Clearly H contains no cycle.
Conjecture: The graph H constructed above is connected and hence it is a tree.

Examples

			a(4)=6 since 2(a(3)+1)=10=6+4 with 4 and 6 both practical, and 6>a(3)=4.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n]
    Pow[n_,i_]:=Pow[n,i]=Part[Part[f[n],i],1]^(Part[Part[f[n],i],2])
    Con[n_]:=Con[n]=Sum[If[Part[Part[f[n],s+1],1]<=DivisorSigma[1,Product[Pow[n,i],{i,1,s}]]+1,0,1],{s,1,Length[f[n]]-1}]
    pr[n_]:=pr[n]=n>0&&(n<3||Mod[n,2]+Con[n]==0)
    k=1
    n=1
    Do[If[m==1,Print[n," ",1]];If[m==k,n=n+1;Do[If[pr[2j]==True&&pr[2m+2-2j]==True,k=2j;Print[n," ",2j];Goto[aa]],{j,Ceiling[(m+1)/2],m}]];
    Label[aa];Continue,{m,1,1000}]

A198472 a(n)=q(n) if 4 | q(n)-2, and a(n)=q(n)/2 if 4 | q(n), where q(n) is the least practical number q>n with 2(n+1)-q practical.

Original entry on oeis.org

2, 2, 2, 6, 6, 4, 4, 6, 6, 8, 6, 18, 8, 18, 8, 18, 18, 10, 10, 12, 12, 14, 12, 30, 14, 30, 14, 30, 30, 16, 16, 18, 18, 20, 18, 42, 20, 42, 20, 42, 42, 54, 24, 24, 28, 54, 24, 28, 30, 54, 28, 32, 54, 28, 28, 30, 30, 32, 30, 66, 32, 66, 32, 66, 66, 78, 36, 36, 40, 78, 36, 40, 42, 78, 40, 44, 78, 40, 40, 42, 42, 44, 42, 90, 44, 90, 44, 90, 90, 52, 48, 48, 50, 50, 48, 52, 50, 54, 50, 56
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 27 2013

Keywords

Comments

Conjecture: If b(1)>=4 is an integer and b(k+1)=a(b(k)) for k=1,2,3,..., then b(n)=4 for some n>0.
This conjecture has the same flavor as the Collatz conjecture.

Examples

			a(20)=12 since 2(20+1)=24+18 with 24 and 18 both practical.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n]
    Pow[n_,i_]:=Pow[n,i]=Part[Part[f[n],i],1]^(Part[Part[f[n],i],2])
    Con[n_]:=Con[n]=Sum[If[Part[Part[f[n],s+1],1]<=DivisorSigma[1,Product[Pow[n,i],{i,1,s}]]+1,0,1],{s,1,Length[f[n]]-1}]
    pr[n_]:=pr[n]=n>0&&(n<3||Mod[n,2]+Con[n]==0)
    Do[Do[If[pr[2k]==True&&pr[2n+2-2k]==True,Print[n," ",2k/(1+Mod[k-1,2])];Goto[aa]],{k,Ceiling[(n+1)/2],n}];
    Label[aa];Continue,{n,1,100}]
  • PARI
    A198472(n) = forstep(q=n+++bittest(n,0),9e9,2, is_A005153(q) && is_A005153(2*n-q) && return(if(q%4,q,q\2))) \\ M. F. Hasler, Feb 27 2013

A213187 a(n) = (p+1)/2 if 4 | p+1, and p otherwise, where p is the least prime > n with 2(n+1)-p prime.

Original entry on oeis.org

2, 2, 5, 5, 4, 4, 6, 6, 13, 6, 13, 13, 17, 17, 10, 17, 10, 10, 12, 12, 16, 12, 29, 16, 29, 16, 37, 29, 16, 16, 41, 37, 37, 41, 41, 37, 24, 41, 22, 41, 22, 22, 24, 24, 61, 24, 53, 61, 53, 30, 61, 53, 61, 34, 30, 61, 73, 30, 61, 61, 36, 34, 34, 36, 36, 34, 42, 36, 73, 36, 73, 73, 89, 40, 40, 42, 42, 40, 89, 42, 97, 42, 89, 97, 89, 101, 97, 89, 97, 52, 101, 97, 109, 101, 52, 97, 54, 101, 52, 101
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 28 2013

Keywords

Comments

Conjecture: If b(1)>2 is an integer, and b(k+1)=a(b(k)) for k=1,2,3,..., then b(n)=4 for some n>0.
For example, if we start from b(1)=45 then we get the sequence 45, 61, 36, 37, 24, 16, 17, 10, 6, 4, 5, 4, ...

Examples

			a(8)=6 since 2(8+1)=11+5 with (11+1)/2=6;
a(9)=13 since 2(9+1)=13+7.
		

Crossrefs

Programs

  • Mathematica
    Do[Do[If[PrimeQ[2n+2-Prime[k]]==True,Print[n," ",If[Mod[Prime[k],4]==3,(Prime[k]+1)/2,Prime[k]]];Goto[aa]],{k,PrimePi[n]+1,PrimePi[2n]}];
    Label[aa];Continue,{n,1,100}]
    nxt[{n_,a_}]:=Module[{p=NextPrime[n]},While[!PrimeQ[2(n+1)-p],p = NextPrime[ p]];{n+1,If[Divisible[p+1,4],(p+1)/2,p]}]; Rest[ Transpose[ NestList[ nxt,{1,2},110]][[2]]] (* Harvey P. Dale, May 30 2016 *)
  • PARI
    a(n)=my(q=nextprime(n+1)); while(!isprime(2*n+2-q),q=nextprime(q+1)); if(q%4<3,q,(q+1)/2) \\ Charles R Greathouse IV, Feb 28 2013
Showing 1-6 of 6 results.