mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Release calc version 2.12.0
This commit is contained in:
18
help/ptest
18
help/ptest
@@ -82,19 +82,19 @@ RUNTIME
|
||||
the standard algorithms.
|
||||
|
||||
EXAMPLE
|
||||
> print ptest(103^3 * 3931, 0), ptest(4294967291,0)
|
||||
; print ptest(103^3 * 3931, 0), ptest(4294967291,0)
|
||||
1 1
|
||||
|
||||
In the first example, the first argument > 2^32; in the second the
|
||||
first argument is the largest prime less than 2^32.
|
||||
|
||||
> print ptest(121,-1,2), ptest(121,-1,3), ptest(121,-2,2)
|
||||
; print ptest(121,-1,2), ptest(121,-1,3), ptest(121,-2,2)
|
||||
0 1 0
|
||||
|
||||
121 is the smallest strong pseudoprime to the base 3.
|
||||
|
||||
> x = 151 * 751 * 28351
|
||||
> print x, ptest(x,-4,1), ptest(x,-5,1)
|
||||
; x = 151 * 751 * 28351
|
||||
; print x, ptest(x,-4,1), ptest(x,-5,1)
|
||||
3215031751 1 0
|
||||
|
||||
The integer x in this example is the smallest positive integer that is
|
||||
@@ -102,14 +102,14 @@ EXAMPLE
|
||||
not to base 11. The probability that ptest(x,-1,0) will return 1 is
|
||||
about .23.
|
||||
|
||||
> for (i = 0; i < 11; i++) print ptest(91,-1,0),:; print;
|
||||
; for (i = 0; i < 11; i++) print ptest(91,-1,0),:; print;
|
||||
0 0 0 1 0 0 0 0 0 0 1
|
||||
|
||||
The results for this example depend on the state of the
|
||||
random number generator; the expectation is that 1 will occur twice.
|
||||
|
||||
> a = 24444516448431392447461 * 48889032896862784894921;
|
||||
> print ptest(a,11,1), ptest(a,12,1), ptest(a,20,2), ptest(a,21,2)
|
||||
; a = 24444516448431392447461 * 48889032896862784894921;
|
||||
; print ptest(a,11,1), ptest(a,12,1), ptest(a,20,2), ptest(a,21,2)
|
||||
1 0 1 0
|
||||
|
||||
These results show that a is a strong pseudoprime for all 11 prime
|
||||
@@ -144,8 +144,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.2 $
|
||||
## @(#) $Id: ptest,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: ptest,v 29.3 2006/05/07 07:25:46 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/ptest,v $
|
||||
##
|
||||
## Under source code control: 1996/02/25 00:27:43
|
||||
|
Reference in New Issue
Block a user