A158754 Courteous prime numbers.
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
Keywords
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 *)
Comments