Strange plus numbers: Difference between revisions
Content added Content deleted
(Added solution for Action!) |
(Added XPL0 example.) |
||
Line 1,361: | Line 1,361: | ||
389 411 412 414 416 430 432 434 438 470 |
389 411 412 414 416 430 432 434 438 470 |
||
474 476 492 494 498</pre> |
474 476 492 494 498</pre> |
||
=={{header|XPL0}}== |
|||
<lang XPL0>func StrangePlus(N); |
|||
int N, A, B, S; |
|||
[N:= N/10; |
|||
A:= rem(0); |
|||
loop [N:= N/10; |
|||
B:= rem(0); |
|||
S:= A+B; |
|||
if S#2 & S#3 & S#5 & S#7 & S#11 & S#13 & S#17 then return false; |
|||
if N = 0 then return true; |
|||
A:= B]; |
|||
]; |
|||
int Cnt, N; |
|||
[Cnt:= 0; |
|||
for N:= 100 to 500-1 do |
|||
if StrangePlus(N) then |
|||
[Cnt:= Cnt+1; |
|||
IntOut(0, N); |
|||
if rem(Cnt/20) = 0 then CrLf(0) else ChOut(0, ^ )]; |
|||
]</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> |