Strange plus numbers: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add CLU) |
Not a robot (talk | contribs) (Add Draco) |
||
Line 611: | Line 611: | ||
readln; |
readln; |
||
end.</lang> |
end.</lang> |
||
=={{header|Draco}}== |
|||
<lang draco>proc small_prime(word n) bool: |
|||
word primes = 0x8A2B; |
|||
n>=2 and primes >> (n-2) & 1 = 1 |
|||
corp |
|||
proc strange_plus(word n) bool: |
|||
word dl, dr; |
|||
bool pair_prime; |
|||
dl := n % 10; |
|||
while |
|||
dr := dl; |
|||
n := n / 10; |
|||
dl := n % 10; |
|||
pair_prime := small_prime(dl + dr); |
|||
pair_prime and n >= 10 |
|||
do od; |
|||
pair_prime and n < 10 |
|||
corp |
|||
proc main() void: |
|||
byte col; |
|||
word cand; |
|||
col := 0; |
|||
for cand from 101 upto 499 do |
|||
if strange_plus(cand) then |
|||
write(cand:4); |
|||
col := col + 1; |
|||
if col = 10 then writeln(); col := 0 fi |
|||
fi |
|||
od |
|||
corp</lang> |
|||
{{out}} |
|||
<pre> 111 112 114 116 120 121 123 125 129 141 |
|||
143 147 149 161 165 167 202 203 205 207 |
|||
211 212 214 216 230 232 234 238 250 252 |
|||
256 258 292 294 298 302 303 305 307 320 |
|||
321 323 325 329 341 343 347 349 383 385 |
|||
389 411 412 414 416 430 432 434 438 470 |
|||
474 476 492 494 498</pre> |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |