Jump to content

Jordan-Pólya numbers: Difference between revisions

m
(J draft)
m (→‎{{header|J}}: faster)
Line 24:
 
=={{header|J}}==
<syntaxhighlight lang=J>Pjpfct=: p{{ _2}.!x:i.100x->.!inv 1+y }}
F=: !P
 
jpfct=: {{ 2}.!x:i.>.!inv 1+y }}
jpprm=: P{.~F I. 1+]
 
isjp=: {{
if. 2>y do. y return.
elseif. 0 < #(q:y)-.jpprm y do. 0 return.
else.
else. + for_f./isjp (#~ ] = <.) (%jpfct) y do.
if. 2>yisjp f do. i.01 return. end.
end.
end.
}}" 0
}}"0</syntaxhighlight>
 
showjp=: {{
if. 2>y do. i.0 return. end.
F=. f{~1 i:~b #inv isjp Y#~b=. (]=<.) Y=. y%f=. jpfct y
F,showjp y%F
}}</syntaxhighlight>
 
Task:
6,962

edits

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