Pierpont primes: Difference between revisions

m (→‎{{header|Phix}}: added syntax colouring the hard way)
Line 1,476:
62207 73727 131071 139967 165887 294911 314927 442367 472391 497663
524287 786431 995327 1062881 2519423 10616831 17915903 18874367 25509167 30233087</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>ClearAll[FindUpToMax]
FindUpToMax[max_Integer, b_Integer] := Module[{res, num},
res = {};
Do[
num = 2^u 3^v + b;
If[PrimeQ[num], AppendTo[res, num]]
,
{u, 0, Ceiling@Log[2, max]}
,
{v, 0, Ceiling@Log[3, max]}
];
res //= Select[LessEqualThan[max]];
res //= Sort;
res
]
Print["Piermont primes of the first kind:"]
Take[FindUpToMax[10^10, +1], UpTo[50]]
Print["Piermont primes of the second kind:"]
Take[FindUpToMax[10^10, -1], UpTo[50]]
Print["250th Piermont prime of the first kind:"]
Part[FindUpToMax[10^34, +1], 250]
Print["250th Piermont prime of the second kind:"]
Part[FindUpToMax[10^34, -1], 250]
Print["1000th Piermont prime of the first kind:"]
Part[FindUpToMax[10^130, +1], 1000]
Print["1000th Piermont prime of the second kind:"]
Part[FindUpToMax[10^150, -1], 1000]</lang>
{{out}}
<pre>Piermont primes of the first kind:
{2,3,5,7,13,17,19,37,73,97,109,163,193,257,433,487,577,769,1153,1297,1459,2593,2917,3457,3889,10369,12289,17497,18433,39367,52489,65537,139969,147457,209953,331777,472393,629857,746497,786433,839809,995329,1179649,1492993,1769473,1990657,2654209,5038849,5308417,8503057}
Piermont primes of the second kind:
{2,3,5,7,11,17,23,31,47,53,71,107,127,191,383,431,647,863,971,1151,2591,4373,6143,6911,8191,8747,13121,15551,23327,27647,62207,73727,131071,139967,165887,294911,314927,442367,472391,497663,524287,786431,995327,1062881,2519423,10616831,17915903,18874367,25509167,30233087}
250th Piermont primes of the first kind:
62518864539857068333550694039553
250th Piermont primes of the second kind:
4111131172000956525894875083702271
1000th Piermont prime of the first kind:
69269314716439690250482558089997110961545818230232043107188537422260188701607997086273960899938499201024414931399264696270849
1000th Piermont prime of the second kind:
1308088756227965581249669045506775407896673213729433892383353027814827286537163695213418982500477392209371001259166465228280492460735463423</pre>
 
 
=={{header|Nim}}==
1,111

edits