Quantcast
Channel: Primality-testing one-liner
Browsing latest articles
Browse All 6 View Live

Primality-testing one-liner

Hey guys, long time no see! I just wanted to show you guys a one-liner I'm pretty proud of that determines whether a number is prime or not. It gives an error for numbers less than 16 and greater than...

View Article



Re: Primality-testing one-liner

Very nice! But jonbush has already created an even smaller primality test: min(remainder(Ans,seq(A,A,2,1+√(Ans This checks if Ans is prime. Returns 1 if prime, 0 if composite.

View Article

Re: Primality-testing one-liner

Answer: 0 and 257 do not work with as binomcdf('s first argument in with a probability of 0. I would suggest looking at the Math One Liners.

View Article

Re: Primality-testing one-liner

Woah! That's amazing. Thanks for pointing out that page.

View Article

Re: Primality-testing one-liner

That whole set of routines has some really cool stuff in there.

View Article


Re: Primality-testing one-liner

Additionally, you can click on "Options" to edit your post instead of double-posting. :)

View Article
Browsing latest articles
Browse All 6 View Live




Latest Images