Jump to content

Deceptive numbers: Difference between revisions

→‎OCaml: move the primality test to the end, ~12% faster
m (Correcting a typing error.)
(→‎OCaml: move the primality test to the end, ~12% faster)
Line 67:
 
=={{header|Arturo}}==
 
<syntaxhighlight lang="rebol">deceptive?: function [n][
and? -> not? prime? n
Line 265 ⟶ 264:
97273 97681 100001 101101 101491 102173 108691 113201 115627 115921
</pre>
 
=={{header|Factor}}==
{{works with|Factor|0.99 2021-06-02}}
Line 291:
if Isprime(n)>1 and Divides(n,Rep(n-1)) then !!n; c:+; fi
od;</syntaxhighlight>
 
 
=={{header|Go}}==
Line 337 ⟶ 336:
 
=={{header|J}}==
 
<syntaxhighlight lang="j">R=: (10x #. #&1)"0
deceptive=: 1&p: < 0 = ] | R@<:
Line 669 ⟶ 667:
x * x <= n && (n mod x = 0 || n mod (x + 4) = 0 || loop (x + 6))
in
n land 1 <> 0 && n mod 3 <> 0 && n mod 5 <> 0 && loop 7 &&
modpow n 10 (pred n) = 1 && loop 7
 
let () =
Line 947 ⟶ 945:
 
=={{header|Quackery}}==
 
<code>isprime</code> is defined at [[Primality by trial division#Quackery]].
 
Line 988 ⟶ 985:
<pre>[91, 259, 451, 481, 703, 1729, 2821, 2981, 3367, 4141, 4187, 5461, 6533, 6541, 6601, 7471, 7777, 8149, 8401, 8911, 10001, 11111, 12403, 13981, 14701]
</pre>
 
=={{header|Rust}}==
<syntaxhighlight lang="rust">// [dependencies]
Line 1,060 ⟶ 1,058:
(91 259 451 481 703 1729 2821 2981 3367 4141)
</pre>
 
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">say 100.by {|n|
559

edits

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