2 prevprime - nearest prime less than specified number
11 return positive integer or err
14 If n is an integer and 2 < n < 2^32, prevprime(n) returns the
15 nearest prime less than n.
17 If n <= 2 or >= 2^32 or n is fractional, prevprime(n, err)
18 returns the value of err.
20 Other cases cause a runtime error.
23 ; print prevprime(10), prevprime(100), prevprime(1e6)
26 ; print prevprime(2,-99), prevprime(2^32,-99)
36 FULL zpprime(ZVALUE z)
39 factor, isprime, lfactor, nextcand, nextprime, prevcand,
42 ## Copyright (C) 1999-2006 Landon Curt Noll
44 ## Calc is open software; you can redistribute it and/or modify it under
45 ## the terms of the version 2.1 of the GNU Lesser General Public License
46 ## as published by the Free Software Foundation.
48 ## Calc is distributed in the hope that it will be useful, but WITHOUT
49 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
50 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
51 ## Public License for more details.
53 ## A copy of version 2.1 of the GNU Lesser General Public License is
54 ## distributed with calc under the filename COPYING-LGPL. You should have
55 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
56 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
58 ## @(#) $Revision: 30.1 $
59 ## @(#) $Id: prevprime,v 30.1 2007/03/16 11:10:42 chongo Exp $
60 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/prevprime,v $
62 ## Under source code control: 1995/12/18 12:34:58
63 ## File existed as early as: 1995
65 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
66 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/