Numbers whose binary and ternary digit sums are prime: Difference between revisions
Numbers whose binary and ternary digit sums are prime (view source)
Revision as of 17:03, 7 January 2024
, 4 months ago→{{header|Wren}}: More minor changes.
m (→{{header|Wren}}: More minor changes.) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1,638:
157 162 167 171 173 179 181 185 191 193
199</pre>
=={{header|Quackery}}==
<code>digitsum</code> is defined at [[Sum digits of an integer#Quackery]].
<code>isprime</code> is defined at [[Primality by trial division#Quackery]].
<syntaxhighlight lang="Quackery"> []
200 times
[ i^ 3 digitsum isprime while
i^ 2 digitsum isprime while
i^ join ]
echo</syntaxhighlight>
{{out}}
<pre>[ 5 6 7 10 11 12 13 17 18 19 21 25 28 31 33 35 36 37 41 47 49 55 59 61 65 67 69 73 79 82 84 87 91 93 97 103 107 109 115 117 121 127 129 131 133 137 143 145 151 155 157 162 167 171 173 179 181 185 191 193 199 ]</pre>
=={{header|Raku}}==
Line 1,844 ⟶ 1,861:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="wren">import "./math" for Int
var numbers = []
Line 1,858 ⟶ 1,873:
}
System.print("Numbers < 200 whose binary and ternary digit sums are prime:")
Fmt.tprint("$4d", numbers, 14)
System.print("\nFound %(numbers.count) such numbers.")</syntaxhighlight>
|