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.

A158754 Courteous prime numbers.

Original entry on oeis.org

31, 41, 101, 109, 137, 191, 193, 239, 283, 311, 313, 569, 641, 659, 661, 821, 1091, 1153, 1289, 1291, 1301, 1303, 1319, 1429, 1453, 1619, 1667, 1877, 2027, 2081, 2129, 2239, 2309, 2341, 2381, 2591, 2593, 2711, 2713, 2971, 3001, 3121, 3253, 3299, 3301
Offset: 1

Views

Author

Keywords

Comments

Courteous prime numbers are twin prime numbers and can be written as the sum of two or more consecutive twin prime numbers. 7+11+13=31,11+13+17=41,..

Crossrefs

Programs

  • Mathematica
    lst={};Do[pp=Prime[m];If[PrimeQ[pp-2]||PrimeQ[pp+2],k=1;Do[k++;p=Prime[n];If[PrimeQ[p-2]||PrimeQ[p+2],pp+=p;If[PrimeQ[pp],If[PrimeQ[pp-2]||PrimeQ[pp+2],AppendTo[lst,pp]]]],{n,m+1,4*6!}]],{m,1,4*6!}];lst;(*Courteous Prime Numbers.*)Take[Union[lst],5! ]
    upto=3400;With[{tps=Union[Flatten[Select[Partition[Prime[Range[ PrimePi[ upto]]], 2,1], Last[#]-First[#]==2&]]]}, Select[Union[Flatten[Table[ Total/@Partition[tps,n,1],{n,2,40}]]],MemberQ[tps,#]&&#<=upto&]] (* Harvey P. Dale, Sep 25 2011 *)