Penta-power prime seeds
Penta-power prime seeds is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Generate the sequence of quad-power prime seeds: positive integers n such that:
n0 + n + 1, n1 + n + 1, n2 + n + 1, n3 + n + 1 and n4 + n + 1 are all prime.
- Task
- Find and display the first thirty quad-power plus prime seeds.
- Stretch
- Find and display the position and value of first with a value greater than ten million.
- See also
I can find no mention or record of this sequence anywhere. Perhaps I've invented it.
Raku
<lang perl6>use Lingua::EN::Numbers;
my @qppps = lazy (1..*).hyper(:2000batch).grep: -> \n { my \k = n + 1; (1+k).is-prime && (n+k).is-prime && (n²+k).is-prime && (n³+k).is-prime && (n⁴+k).is-prime }
say "First thirty quad-power plus prime seeds:\n" ~ @qppps[^30].batch(10)».&comma».fmt("%9s").join: "\n";
say "\nFirst quad-power plus prime seed greater than:";
for 1..10 {
my $threshold = Int(1e6 * $_); my $key = @qppps.first: * > $threshold, :k; say "{$threshold.&cardinal.fmt: '%13s'} is the {ordinal-digit $key + 1}: {@qppps[$key].&comma}";
}</lang>
- Output:
First thirty quad-power plus prime seeds: 1 5 69 1,665 2,129 25,739 29,631 62,321 77,685 80,535 82,655 126,489 207,285 211,091 234,359 256,719 366,675 407,945 414,099 628,859 644,399 770,531 781,109 782,781 923,405 1,121,189 1,158,975 1,483,691 1,490,475 1,512,321 First quad-power plus prime seed greater than: one million is the 26th: 1,121,189 two million is the 39th: 2,066,079 three million is the 47th: 3,127,011 four million is the 51st: 4,059,525 five million is the 59th: 5,279,175 six million is the 63rd: 6,320,601 seven million is the 68th: 7,291,361 eight million is the 69th: 8,334,915 nine million is the 71st: 9,100,671 ten million is the 72nd: 10,347,035