Strange unique prime triplets: Difference between revisions
Content added Content deleted
(Added Quackery.) |
|||
Line 2,244: | Line 2,244: | ||
If n, m, p < 1_000 finds 241_580</pre> |
If n, m, p < 1_000 finds 241_580</pre> |
||
=={{header|Quackery}}== |
|||
<code>isprime</code> is defined at [[Primality by trial division#Quackery]]. |
|||
<code>comb</code> is defined at [[Combinations#Quackery]]. |
|||
<syntaxhighlight lang="Quackery"> [ dup size dip |
|||
[ witheach |
|||
[ over swap peek swap ] ] |
|||
nip pack ] is arrange ( [ [ --> [ ) |
|||
[ 0 swap witheach + ] is sum ( [ --> n ) |
|||
[] 30 times |
|||
[ i^ isprime if |
|||
[ i^ join ] ] |
|||
behead drop |
|||
3 over size comb |
|||
[] unrot |
|||
witheach |
|||
[ over swap arrange |
|||
dup sum |
|||
isprime not iff |
|||
drop done |
|||
nested swap dip join ] |
|||
drop |
|||
sortwith [ sum dip sum > ] |
|||
dup size echo |
|||
say " strange unique prime triplets found:" |
|||
cr cr |
|||
witheach |
|||
[ dup witheach |
|||
[ echo |
|||
i if say "+" ] |
|||
say " = " sum echo |
|||
cr ]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>3+5+11 = 19 |
|||
3+7+13 = 23 |
|||
5+7+11 = 23 |
|||
3+7+19 = 29 |
|||
5+7+17 = 29 |
|||
5+11+13 = 29 |
|||
3+5+23 = 31 |
|||
3+11+17 = 31 |
|||
5+7+19 = 31 |
|||
7+11+13 = 31 |
|||
3+5+29 = 37 |
|||
3+11+23 = 37 |
|||
5+13+19 = 37 |
|||
7+11+19 = 37 |
|||
7+13+17 = 37 |
|||
5+7+29 = 41 |
|||
5+13+23 = 41 |
|||
5+17+19 = 41 |
|||
7+11+23 = 41 |
|||
11+13+17 = 41 |
|||
3+11+29 = 43 |
|||
3+17+23 = 43 |
|||
7+13+23 = 43 |
|||
7+17+19 = 43 |
|||
11+13+19 = 43 |
|||
5+13+29 = 47 |
|||
5+19+23 = 47 |
|||
7+11+29 = 47 |
|||
7+17+23 = 47 |
|||
11+13+23 = 47 |
|||
11+17+19 = 47 |
|||
5+19+29 = 53 |
|||
7+17+29 = 53 |
|||
11+13+29 = 53 |
|||
11+19+23 = 53 |
|||
13+17+23 = 53 |
|||
7+23+29 = 59 |
|||
11+19+29 = 59 |
|||
13+17+29 = 59 |
|||
17+19+23 = 59 |
|||
13+19+29 = 61 |
|||
19+23+29 = 71</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |