Honaker primes: Difference between revisions

Add Factor
(Add Factor)
Line 117:
 
Honaker prime 10000 is prime 286069: 4043749
</pre>
 
=={{header|Factor}}==
{{works with|Factor|0.99 2022-04-03}}
<syntaxhighlight lang=factor>USING: grouping kernel lists lists.lazy math math.primes.lists
prettyprint sequences ;
 
: sum-digits ( n -- sum )
0 swap [ 10 /mod rot + swap ] until-zero ;
 
: honaker ( -- list )
1 lfrom lprimes lzip [ first2 [ sum-digits ] same? ] lfilter ;
 
50 honaker ltake list>array 5 group simple-table.
</syntaxhighlight>
{{out}}
<pre>
{ 32 131 } { 56 263 } { 88 457 } { 175 1039 } { 176 1049 }
{ 182 1091 } { 212 1301 } { 218 1361 } { 227 1433 } { 248 1571 }
{ 293 1913 } { 295 1933 } { 323 2141 } { 331 2221 } { 338 2273 }
{ 362 2441 } { 377 2591 } { 386 2663 } { 394 2707 } { 397 2719 }
{ 398 2729 } { 409 2803 } { 439 3067 } { 446 3137 } { 457 3229 }
{ 481 3433 } { 499 3559 } { 508 3631 } { 563 4091 } { 571 4153 }
{ 595 4357 } { 599 4397 } { 635 4703 } { 637 4723 } { 655 4903 }
{ 671 5009 } { 728 5507 } { 751 5701 } { 752 5711 } { 755 5741 }
{ 761 5801 } { 767 5843 } { 779 5927 } { 820 6301 } { 821 6311 }
{ 826 6343 } { 827 6353 } { 847 6553 } { 848 6563 } { 857 6653 }
</pre>
 
1,827

edits