Numbers whose binary and ternary digit sums are prime: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: simplified the code.) |
(Add Plain English) |
||
Line 850: | Line 850: | ||
193 |
193 |
||
199</pre> |
199</pre> |
||
=={{header|Plain English}}== |
|||
<lang plainenglish>To run: |
|||
Start up. |
|||
Loop. |
|||
If a counter is past 200, break. |
|||
If the counter has prime digit sums in binary and ternary, write the counter then " " on the console without advancing. |
|||
Repeat. |
|||
Wait for the escape key. |
|||
Shut down. |
|||
A sum is a number. |
|||
A base is a number. |
|||
To find a digit sum of a number given a base: |
|||
Privatize the number. |
|||
Loop. |
|||
Divide the number by the base giving a quotient and a remainder. |
|||
Add the remainder to the digit sum. |
|||
Put the quotient into the number. |
|||
If the number is 0, exit. |
|||
Repeat. |
|||
To decide if a number has prime digit sums in binary and ternary: |
|||
Find a digit sum of the number given 2. |
|||
If the digit sum is not prime, say no. |
|||
Find another digit sum of the number given 3. |
|||
If the other digit sum is not prime, say no. |
|||
Say yes.</lang> |
|||
{{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|Phix}}== |
=={{header|Phix}}== |