Super-Poulet numbers: Difference between revisions

Add Factor
(→‎{{header|Wren}}: Tweak, bit quicker.)
(Add Factor)
Line 17:
;*[[oeis:A050217|OEIS:A050217 - super-Poulet numbers]]
 
=={{header|Factor}}==
{{works with|Factor|0.99 2022-04-03}}
<lang factor>USING: combinators.short-circuit io kernel lists lists.lazy math
math.functions math.primes math.primes.factors prettyprint
sequences ;
 
: super-poulet? ( n -- ? )
{
[ prime? not ]
[ [ 1 - 2^ ] keep mod 1 = ]
[ divisors [ [ 2^ 2 - ] keep divisor? ] all? ]
} 1&& ;
 
: super-poulets ( -- list )
1 lfrom [ super-poulet? ] lfilter ;
 
20 super-poulets ltake [ pprint bl ] leach nl</lang>
{{out}}
<pre>
341 1387 2047 2701 3277 4033 4369 4681 5461 7957 8321 10261 13747 14491 15709 18721 19951 23377 31417 31609
</pre>
 
=={{header|Julia}}==
1,808

edits