The bug seems to be confined to the argument 1x .  4 p: x searches x+2, x+4, ... for primes.  It starts at x+1 if x is even or is non-extended 1; but for extended 1 it starts at x+2.

Henry Rich

On 4/25/2020 4:48 AM, 'Michael Day' via Programming wrote:
Investigating how to factor quite large numbers in J,  I've just bumped into this curiosity, which

wrecked my loopy experiment at an early stage!...

   4 p: 1
2
   4 p: 1x   NB. need to try extended in some cases...
3

!

Thanks for any advice,

Mike


On 25/04/2020 00:15, 'Mike Day' via Programming wrote:
Numbers of divisors below, not the divisors themselves... the thread had split! I was attempting to comment on Hauke Rehr’s post.
M

Sent from my iPad

On 24 Apr 2020, at 23:52, 'Jon' via Programming <[email protected]> wrote:

This is missing a few divisors. It seems Skip's original method would be difficult to beat. It's O(n) in time and space. You could improve space complexity by doing a simple loop, but as far as I can see there are no shortcuts, and the best way is to just "brute force" it.

⁣Sent from BlueMail ​

On Apr 25, 2020, 5:35 AM, at 5:35 AM, 'Mike Day' via Programming <[email protected]> wrote:
I think this is near to the approved way:

  (*/"1@:>:@(_& q:))24 360 4711
8 24 4

Mike

Sent from my iPad




--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to