Jump to content

Chernick's Carmichael numbers: Difference between revisions

J
m (added a category.)
(J)
Line 449:
Factors: [19250317175041 38500634350081 57750951525121 115501903050241 231003806100481 462007612200961 924015224401921 1848030448803841 3696060897607681 7392121795215361]
</pre>
 
=={{header|j}}==
 
Brute force:
 
<lang J>a=: {{)v
if.3=y do.1729 return.end.
m=. z=. 2^y-4
f=. 6 12,9*2^}.i.y-1
while.do.
uf=.1+f*m
if.*/1 p: uf do. */x:uf return.end.
m=.m+z
end.
}}</lang>
 
Task examples:
 
<lang J> a 3
1729
a 4
63973
a 5
26641259752490421121
a 6
1457836374916028334162241
a 7
24541683183872873851606952966798288052977151461406721
a 8
53487697914261966820654105730041031613370337776541835775672321
a 9
58571442634534443082821160508299574798027946748324125518533225605795841</lang>
 
=={{header|Java}}==
6,962

edits

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