primegen man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

primegen(3)							   primegen(3)

NAME
       primegen - enumerate small primes

SYNTAX
       #include <primegen.h>

       void primegen_init(&pg);
       uint64 primegen_next(&pg);
       uint64 primegen_peek(&pg);
       uint64 primegen_count(&pg,bound);
       void primegen_skipto(&pg,bound);

       struct primegen pg;
       uint64 bound;

DESCRIPTION
       The primegen library generates prime numbers in order: 2, 3, 5, 7, etc.
       It can generate primes as large as 10^15.

       The simplest way to use primegen is to call primegen_init and then call
       primegen_next  repeatedly.  The first call to primegen_next will return
       2; the next call will return 3; the next call will return 5; and so on.

       At each moment the next few primes to be returned by primegen_next  are
       buffered	 inside	 pg.   primegen_init initializes pg with the first few
       primes, starting at 2.	You  must  initialize  pg  with	 primegen_init
       before  using pg with any of the other primegen routines.  You may call
       primegen_init again to start over at 2.

       primegen_next returns the next buffered prime and  removes  that	 prime
       from  pg.   primegen_peek  returns the next buffered prime but does not
       change pg.

       primegen_skipto discards all primes up  to  bound.   It	has  the  same
       effect as

	    while (primegen_peek(&pg) < bound)
	      primegen_next(&pg);

       primegen_count  discards	 all primes up to bound and returns the number
       of primes discarded.

       You can set up several independent generators;  all  primegen  data  is
       stored  in pg.  Beware, however, that each struct primegen uses quite a
       bit of memory.

SEE ALSO
       primes(1), primespeed(1)

								   primegen(3)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net