Smallest number k such that k+2^m is composite for all m less than k: Difference between revisions
Smallest number k such that k+2^m is composite for all m less than k (view source)
Revision as of 20:00, 12 January 2022
, 2 years agoAdded Perl
SqrtNegInf (talk | contribs) (Added Perl) |
|||
Line 26:
[[oeis:A033919|OEIS:A033939 - Odd k for which k+2^m is composite for all m < k]]
=={{header|Perl}}==
{{libheader|ntheory}}
<lang perl>use strict;
use warnings;
use bigint;
use ntheory 'is_prime';
my $cnt;
LOOP: for my $k (2..1e10) {
next unless 1 == $k % 2;
for my $m (1..$k-1) {
next LOOP if is_prime $k + (1<<$m)
}
print "$k ";
last if ++$cnt == 5;
}</lang>
{{out}}
<pre>773 2131 2491 4471 5101</pre>
=={{header|Phix}}==
|