CoCoALib-0.9905 date: 23 May 2007


SmallPrime.H

Go to the documentation of this file.
00001 #ifndef CoCoA_SmallPrime_H
00002 #define CoCoA_SmallPrime_H
00003 
00004 //   Copyright (c)  2005  John Abbott
00005 
00006 //   This file is part of the source of CoCoALib, the CoCoA Library.
00007 
00008 //   CoCoALib is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License (version 2)
00010 //   as published by the Free Software Foundation.  A copy of the full
00011 //   licence may be found in the file COPYING in this directory.
00012 
00013 //   CoCoALib is distributed in the hope that it will be useful,
00014 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //   GNU General Public License for more details.
00017 
00018 //   You should have received a copy of the GNU General Public License
00019 //   along with CoCoA; if not, write to the Free Software
00020 //   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 
00023 namespace CoCoA
00024 {
00025 
00026   bool IsSmallPrime(unsigned long n);
00027   unsigned long NextSmallPrime(unsigned long n);
00028   unsigned long PrevSmallPrime(unsigned long n);
00029   unsigned long FindPrimRoot(unsigned long p);
00030 
00031 
00032   /*-----------------------------------------------------------------*/
00033   /** \include SmallPrime.txt  */
00034   /*-----------------------------------------------------------------*/
00035   class SmallPrimeSource
00036   {
00037   public:
00038     SmallPrimeSource(unsigned long StartingFrom = 0);
00039     ~SmallPrimeSource() {};
00040     SmallPrimeSource& operator++();
00041     friend unsigned long CurrentPrime(const SmallPrimeSource& ps);
00042   private:
00043     unsigned long myCurrentPrime;
00044   };
00045 
00046 
00047   inline unsigned long CurrentPrime(const SmallPrimeSource& ps)
00048   {
00049     return ps.myCurrentPrime;
00050   }
00051 
00052 }  // end of namespace CoCoA
00053 
00054 
00055 
00056 
00057 // RCS header/log
00058 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/SmallPrime.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00059 // $Log: SmallPrime.H,v $
00060 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00061 // Imported files
00062 //
00063 // Revision 1.3  2006/12/06 17:25:43  cocoa
00064 // -- removed #include "config.H"
00065 //
00066 // Revision 1.2  2006/10/06 14:04:15  cocoa
00067 // Corrected position of #ifndef in header files.
00068 // Separated CoCoA_ASSERT into assert.H from config.H;
00069 // many minor consequential changes (have to #include assert.H).
00070 // A little tidying of #include directives (esp. in Max's code).
00071 //
00072 // Revision 1.1.1.1  2006/05/30 11:39:37  cocoa
00073 // Imported files
00074 //
00075 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00076 // Imported files
00077 //
00078 // Revision 1.1.1.1  2005/05/03 15:47:31  cocoa
00079 // Imported files
00080 //
00081 // Revision 1.2  2005/04/19 14:06:04  cocoa
00082 // Added GPL and GFDL licence stuff.
00083 //
00084 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
00085 // Imported files
00086 //
00087 // Revision 1.3  2004/11/12 15:49:29  cocoa
00088 // Tidying prior to 0.90 release.
00089 // (a) documentation improved (or marked as poor)
00090 // (b) sundry minor improvements to the code
00091 //
00092 // Revision 1.1.1.1  2003/09/24 12:55:43  cocoa
00093 // Imported files
00094 //
00095 // Revision 1.2  2003/06/23 16:10:37  abbott
00096 // Minor cleaning prior to public release.
00097 //
00098 // Revision 1.1  2002/01/30 18:06:59  abbott
00099 // Initial revision
00100 //
00101 
00102 #endif

Generated on Wed May 23 13:43:36 2007 for CoCoALib by  doxygen 1.4.6