Special divisors: Difference between revisions

Add CLU
(Added Forth solution)
(Add CLU)
Line 473:
 
Found 72 special divisors N that reverse(D) divides reverse(N) for all divisors D of N, where N < 200</pre>
 
=={{header|CLU}}==
<lang clu>reverse = proc (n: int) returns (int)
r: int := 0
while n>0 do
r := r*10 + n//10
n := n/10
end
return(r)
end reverse
 
special = proc (n: int) returns (bool)
r: int := reverse(n)
for d: int in int$from_to(1,n/2) do
if n//d=0 & r//reverse(d)~=0 then
return(false)
end
end
return(true)
end special
 
start_up = proc ()
po: stream := stream$primary_output()
c: int := 0
for n: int in int$from_to(1,199) do
if special(n) then
stream$putright(po, int$unparse(n), 4)
c := c+1
if c=10 then
stream$putl(po, "")
c := 0
end
end
end
end start_up</lang>
{{out}}
<pre> 1 2 3 4 5 6 7 8 9 11
13 17 19 22 23 26 27 29 31 33
37 39 41 43 44 46 47 53 55 59
61 62 66 67 69 71 73 77 79 82
83 86 88 89 93 97 99 101 103 107
109 113 121 127 131 137 139 143 149 151
157 163 167 169 173 179 181 187 191 193
197 199</pre>
 
=={{header|COBOL}}==
2,096

edits