Deceptive numbers: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
(Added Easylang) |
||
Line 439: | Line 439: | ||
137149 138481 139231 145181 147001 148417 152551 158497 162401 164761 |
137149 138481 139231 145181 147001 148417 152551 158497 162401 164761 |
||
166499 170017 172081 179881 188191 188269 188461 188501 196651 201917 |
166499 170017 172081 179881 188191 188269 188461 188501 196651 201917 |
||
</pre> |
|||
=={{header|EasyLang}}== |
|||
{{trans|C}} |
|||
<syntaxhighlight> |
|||
func modpow b e m . |
|||
r = 1 |
|||
while e > 0 |
|||
if e mod 2 = 1 |
|||
r = r * b mod m |
|||
. |
|||
b = b * b mod m |
|||
e = e div 2 |
|||
. |
|||
return r |
|||
. |
|||
func is_deceptive n . |
|||
if n mod 2 = 1 and n mod 3 <> 0 and n mod 5 <> 0 |
|||
if modpow 10 (n - 1) n = 1 |
|||
x = 7 |
|||
while x * x <= n |
|||
if n mod x = 0 or n mod (x + 4) = 0 |
|||
return 1 |
|||
. |
|||
x += 6 |
|||
. |
|||
. |
|||
. |
|||
. |
|||
while cnt < 10 |
|||
n += 1 |
|||
if is_deceptive n = 1 |
|||
write n & " " |
|||
cnt += 1 |
|||
. |
|||
. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
91 259 451 481 703 1729 2821 2981 3367 4141 |
|||
</pre> |
</pre> |
||