Find numbers n in base 2 where n is prime and all it's digits are 1: Difference between revisions
Find numbers n in base 2 where n is prime and all it's digits are 1 (view source)
Revision as of 01:53, 9 March 2021
, 3 years agoAdd Factor
No edit summary |
(Add Factor) |
||
Line 4:
Find numbers n in base 2 where n is prime and all it's digits are 1
<br>Let 1 < n < 10000
=={{header|Factor}}==
Numbers in base 2 whose digits are all 1: also known as the powers of 2 minus 1.
<lang factor>USING: lists lists.lazy math math.primes prettyprint ;
2 lfrom [ 2^ 1 - ] <lazy-map> [ prime? ] lfilter [ 10,000 < ] lwhile list>array .</lang>
{{out}}
<pre>
{ 3 7 31 127 8191 }
</pre>
=={{header|Ring}}==
|