Curzon numbers: Difference between revisions
Content added Content deleted
(add OCaml) |
(Python: much faster with modpow) |
||
Line 1,198: | Line 1,198: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
<syntaxhighlight lang="python">def is_Curzon(n, k): |
<syntaxhighlight lang="python">def is_Curzon(n, k): |
||
m = k * n + 1 |
|||
return pow(k, n, m) + 1 == m |
|||
for k in [2, 4, 6, 8, 10]: |
for k in [2, 4, 6, 8, 10]: |