Jump to content

Zsigmondy numbers: Difference between revisions

→‎{{header|J}}: minor documentation
(→‎{{header|J}}: minor documentation)
Line 56:
Implementation:<syntaxhighlight lang=J>dp=: -/@:(^/) NB. (a,b) dp n is (a^n)-(b^n)
Zsigmondy=: dp (-.,)&.:q: (dp 1 }. i.)</syntaxhighlight>
 
In other words, <code>2 1 dp 1 2 3 4</code> is <code>1 3 7 15</code>. And coprime is sequence difference (not set difference, since prime factors may repeat) under factorization (generate the sequence of prime factors for each number, remove any common factors and form the product of any that remain).
 
Task examples:<syntaxhighlight lang=J style="width: max-content"> Zs=: Zsigmondy"1 0&(1x+i.20) NB. first 20 in sequence
6,962

edits

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