Special divisors: Difference between revisions

Special divisors in BASIC256
(Special divisors in Python)
(Special divisors in BASIC256)
Line 251:
179 181 187 191 193
197 199</pre>
 
=={{header|BASIC256}}==
<lang freebasic>c = 0
for n = 1 to 200
u = reverse(n)
s = true
for d = 1 to n
if n mod d = 0 then
b = reverse(d)
if u mod b <> 0 then s = false
end if
next d
if s then c += 1 : print n; chr(9);
next n
 
print
print "Found "; c; " special divisors."
end
 
function reverse(n)
u = 0
while n
u = u * 10 + n mod 10
n = n \ 10
end while
return u
end function</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
Found 72 special divisors.</pre>
 
=={{header|BCPL}}==
2,130

edits