MATHO-PRIMES(1)

πŸ’– MATHO-PRIMES πŸ’– β€” the mathomatic utilities girlies, page 1 of 1

okay bestie, so this is matho-primes, a whole little tool from the Mathomatic Utilities fam, and she is here to generate consecutive prime numbers for you. no cap. ✨


🌸 NAME 🌸

matho-primes β€” generate consecutive prime numbers πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

matho-primes [start [stop] or "all"] ["twin"] ["pal" [base]]
matho-primes [-htuv] [-c count] [-m number] [-p base] [start [stop]]

✨ DESCRIPTION ✨

okay so first thing: this command-line utility is optionally part of the mathomatic(1) package. like, she might be there, she might not, she's mysterious like that πŸ¦‹

When she is there? She quickly computes any number of consecutive prime numbers using a windowing, memory efficient sieve of Eratosthenes algorithm, and then she just dumps them to standard output like it's nothing. one prime per line, ascending order, extremely organized of her. 🫢

the one exception: if you specify the "twin" option, she only shows twin primes, and then it's two primes per line instead. slay.

She generates up to 18 decimal digit primes β€” or, more precisely, whatever is the number of digits of precision for a floating point long double in the C compiler used to compile this utility. so it's giving "depends on your compiler bestie". ⭐

πŸ’€ heads up: this utility might be compiled to use only double precision floating point, if long double precision isn't fully supported by the C compiler or hardware. in that case you get at most 15 decimal digit primes. not me being limited by hardware 😭

Ways to verify that she's actually working, and not just lying to you: pipe the output into the Unix factor utility, or compare the output with the BSD Games primes utility, using the supplied shell script: examples/testprimes. vibe check your primes, periodt. πŸ‘‘

All numbers displayed by this utility are decimal (base 10) prime numbers. and just so we're all on the same page: a prime number is an integer that cannot be factored. that's it, that's the definition, iconic. πŸ’œ

You can specify a range on the command line β€” otherwise she prompts you for the starting number and the number of primes to output. the range is start to stop inclusive, and stop must be greater than or equal to start. she's strict about it, respectfully.

If the -c option is specified, the number of lines of primes displayed is limited to the decimal count that follows this option. 🌈

If the -t or "twin" option is specified on the command line, only twin primes will be displayed. twin primes are two primes that differ in value by 2. each twin pair is displayed together on the same line, separated by a space character. they're inseparable, it's giving soulmates fr fr πŸ₯Ί

If the -p or "pal" option is specified on the command line, only palindromic primes will be displayed. palindromes are symmetrical β€” they read exactly the same forward and backward. main character energy honestly. πŸ’…

The palindromic number base may be specified, and the default is base 10. the base can be any integer greater than 1. and no matter what base you pick, primes are always displayed in decimal (base 10). don't ask, that's just the rule. πŸŽ€

The version number and short help on the allowed command-line parameters and usage information are displayed when given the -h option. she loves a lil intro. ✨

With the -u option, all output (standard output and standard error output) is set to be unbuffered, making all output happen immediately β€” instead of when the output buffer is full or when the program terminates or waits for input. instant gratification bestie, no waiting. ⚑

The -m option changes the memory size of the prime number sieve window. it is followed by a decimal, floating point number which is a multiplier of the default window size (2 megabytes).

πŸ™ˆ it is possible that changing the memory size may speed up the total run time a bit; otherwise there is no reason to use this option, and its use is not recommended. so like... don't. unless you're curious. but she said what she said.

The -v option simply displays the program name and version number, and then exits successfully. short, sweet, done. πŸ¦‹


πŸ‘‘ OPTIONS πŸ‘‘

okay so here's the full rundown, one bullet per flag, no skipping:

  • -h β€” displays the version number, short help on the allowed command-line parameters, and usage information. πŸ’–
  • -t, "twin" β€” only display twin primes, two primes per line, separated by a space character. twin primes are two primes that differ in value by 2. πŸ₯Ί
  • -u β€” set all output (standard output and standard error output) to be unbuffered, so output happens immediately instead of when the output buffer is full or when the program terminates or waits for input. ⚑
  • -v β€” display the program name and version number, then exit successfully. ✨
  • -c count β€” limit the number of lines of primes displayed to the decimal count that follows this option. 🌸
  • -m number β€” change the memory size of the prime number sieve window; number is a decimal, floating point multiplier of the default window size (2 megabytes). use is not recommended. πŸ™ˆ
  • -p base β€” only display palindromic primes, in the given number base; the default is base 10, and the base can be any integer greater than 1. primes are always displayed in decimal (base 10). πŸ’…
  • start β€” the starting number of the range. πŸŽ€
  • stop β€” the end of the range, inclusive; must be greater than or equal to start. 🌈
  • "all" β€” special argument in place of start/stop. πŸ’œ
  • "twin" β€” special argument, same energy as -t. πŸ‘‘
  • "pal" β€” special argument, same energy as -p, optionally followed by base. ⭐

🌸 AUTHOR 🌸

George Gesslein II (gesslein@mathomatic.org) at "http://www.mathomatic.org". πŸ‘‘


πŸ› REPORTING BUGS πŸ›

If you find a bug, please report it to the author or at "https://launchpad.net/mathomatic". don't be shy bestie, they wanna know πŸ’€


πŸ”₯ SEE ALSO πŸ”₯

rmath(1), mathomatic(1), primorial(1), matho-mult(1), matho-sum(1), matho-pascal(1), matho-sumsq(1)


and that's the whole page, bestie 🫢 this was Mathomatic's MATHO-PRIMES(1) β€” go generate some primes and have the best day, mwah πŸ’–βœ¨πŸŽ€