2

Is the NetBSD primes utility (or equivalent) available on MacOS in any package, other than via manual download-and-compile (e.g. curl)? I searched quite a lot and couldn't find any package (other than the NetBSD CVS source).

(NetBSD primes is not a prime-sieve to find large/as-yet-unknown primes, just a simple command-line utility which tells you which integers are prime (or composite) in a given (64b) range).

(Unlike Gnu factor which is available via package coreutils "Finding Prime Numbers - “factor” command not found on MacOS", "Is there a practical use for the GNU factor command?")

Note: this question does not belong on AskDifferent since there is no brew/macports package.

  • @slm: I already cited those answers above in my question(!). The lack of acceptable answer was the motivator for this question. So, is primes NetBSD only, or is it (or an equivalent) in other Unixes? – smci Jul 14 '18 at 1:23
  • 1
    Sorry, I missed those #1, #2 links. It's NetBSD only, I installed it long ago on a couple of Linux boxes and I had to build it from source in those instances as well. – slm Jul 14 '18 at 1:24
1

I've never been able to find it in any pre-built package but in this SO Q&A titled: Finding Prime Numbers - “factor” command not found on MacOS, someone posted a Makefile which you can use to download and build factor and primes yourself.

primesieve

As an alternative, there's this package called primesieve which is a different implementation than the NetBSD primes, but is available in brew:

$ brew info primesieve
primesieve: stable 7.0 (bottled)
Fast C/C++ prime number generator
https://primesieve.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/primesieve.rb
==> Dependencies
Build: cmake ✔
| improve this answer | |
  • Thanks for primesieve. I had already cited the answer above when I asked my question and as you saw I don't find the manual-download-and-compile approach acceptable. I was surprised other Unix users never added primes. – smci Jul 14 '18 at 1:30
  • @smci - I believe it's not installed because there are better alternatives at this point. The original NetBSD primes was written in 1980's-1990's. There's a list of alternatives on the primesieves webpage - primesieve.org/links.html#implementations. – slm Jul 14 '18 at 1:31
  • 1
    @smci - I seem to recall another primes app that I installed long ago on Fedora, let me look a bit more b/c you've now peeked by curiosity 8-) – slm Jul 14 '18 at 1:41
  • 1
    @smci - found it - it was this one - mersenne.org/download. I'm sure you already knew about this one. I used to use it to stress test HW – slm Jul 14 '18 at 1:46
  • 1
    @smci - True. My memory of it is long gone then, I just remember finding that same NetBSD primes app and then finding it (or some alt) that was packaged as a RPM/SRPM and messing around w/ it on one of my systems. I know it was a sieve implementation b/c I had used it to look at how it was implemented when I found out about them. Oh well... – slm Jul 14 '18 at 2:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.