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-5 of 5 results.

A222532 a(1)=2; for n >= 1, a(n+1) is the least prime p_m such that a(n)=p_m-p_{m-1}+...+(-1)^{m-k}p_k for some 0

Original entry on oeis.org

2, 5, 7, 13, 17, 23, 31, 37, 43, 53, 59, 67, 73, 83, 89, 101, 109, 113, 131, 149, 157, 163, 173, 179, 197, 223, 257, 263, 269, 277, 283, 311, 347, 389, 401, 421, 431, 487, 503, 523, 557, 569, 577, 601, 613, 641, 661, 709, 733, 739, 773, 823, 827, 857, 883, 929, 947, 953, 977, 983, 997, 1009, 1019, 1031, 1039, 1051, 1097, 1117, 1129, 1151, 1181, 1223, 1229, 1237, 1249, 1279, 1327, 1361, 1373, 1423, 1459, 1481, 1499, 1543, 1559, 1571, 1601, 1621, 1627, 1669, 1693, 1699, 1721, 1733, 1759, 1783, 1823, 1873, 1973, 2011
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 24 2013

Keywords

Comments

Conjecture: For any given prime p, if we define b(1)=p and let b(n+1) be the least prime p_m such that b(n)=p_m-p_{m-1}+...+(-1)^{m-k}p_k for some 0p adjacent if and only if q is the least prime p_m such that p=p_m-p_{m-1}+...+(-1)^{m-k}p_k for some 0
Clearly the graph T contains no cycle. The vertices on the unique path connecting 2 and 71 are listed (in order) below: 2, 5, 7, 13, 17, 23, 31, 37, 43, 53, 59, 67, 73, 83, 89, 101, 109, 113, 131, 149, 139, 107, 97, 79, 71.

Examples

			a(2)=5 and a(3)=7 since 2=5-3 and 5=7-5+3.
		

Crossrefs

Programs

  • Mathematica
    k=1
    n=1
    s[0_]:=0
    s[n_]:=s[n]=Prime[n]-s[n-1]
    Do[If[m==1,Print[n," ",2]];If[m==k,n=n+1;Do[If[s[j]-(-1)^(j-i)*s[i]==Prime[m],k=j;Print[n," ",Prime[j]];Goto[aa]],{j,m+1,PrimePi[3Prime[m]]},{i,0,j-2}]];
    Label[aa];Continue,{m,1,1000}]

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

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

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

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

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.
		

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
Showing 1-5 of 5 results.