Ultra useful primes: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (New Draft Task and Raku example) |
Thundergnat (talk | contribs) m (clarify) |
||
Line 1: | Line 1: | ||
{{draft task}} |
{{draft task}} |
||
An '''ultra-useful prime''' is a member of the sequence where each <span style="font-size:125%;">'''a(n)'''</span> is the smallest integer <span style="font-size:125%;">'''k'''</span> such that <span style="font-size:125%;">'''2<sup>(2<sup>n</sup>)</sup> - k'''</span> is prime. |
An '''ultra-useful prime''' is a member of the sequence where each <span style="font-size:125%;">'''a(n)'''</span> is the smallest positive integer <span style="font-size:125%;">'''k'''</span> such that <span style="font-size:125%;">'''2<sup>(2<sup>n</sup>)</sup> - k'''</span> is prime. |
||
'''''k''' must always be an odd number since 2 to any power is always even.'' |
'''''k''' must always be an odd number since 2 to any power is always even.'' |
Revision as of 20:30, 13 January 2022
Ultra useful primes 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.
An ultra-useful prime is a member of the sequence where each a(n) is the smallest positive integer k such that 2(2n) - k is prime.
k must always be an odd number since 2 to any power is always even.
- Task
- Find and show here, on this page, the first 10 elements of the sequence.
- Stretch
- Find and show the next several elements. (The numbers get really big really fast. Only nineteen elements have been identified as of this writing.)
- See also
Raku
The first 10 take less than a quarter second. 11 through 13, a little under 30 seconds. Drops off a cliff after that.
<lang perl6>sub useful ($n) {
(|$n).map: { my $p = 1 +< ( 1 +< $_ ); ^$p .first: ($p - *).is-prime }
}
put useful 1..10;
put useful 11..13;</lang>
- Output:
1 3 5 15 5 59 159 189 569 105 1557 2549 2439