Jump to content

Strange plus numbers: Difference between revisions

Add CLU
(Add COBOL)
(Add CLU)
Line 475:
389 411 412 414 416 430 432 434 438 470
474 476 492 494 498</pre>
 
=={{header|CLU}}==
<lang clu>small_prime = proc (n: int) returns (bool)
small_primes = sequence[int]$[2,3,5,7,11,13,17]
for p: int in sequence[int]$elements(small_primes) do
if n=p then return(true) end
end
return(false)
end small_prime
 
strange_plus = proc (n: int) returns (bool)
while n >= 10 do
d1: int := n // 10
n := n / 10
d2: int := n // 10
if ~small_prime(d1 + d2) then return(false) end
end
return(true)
end strange_plus
 
start_up = proc ()
po: stream := stream$primary_input()
col: int := 0
for i: int in int$from_to(100,500) do
if strange_plus(i) then
stream$putright(po, int$unparse(i), 4)
col := col + 1
if col // 10 = 0 then stream$putl(po, "") end
end
end
end start_up</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|COBOL}}==
2,115

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.