/* LA: linear algebra C++ interface library Copyright (C) 2008-2023 Jiri Pittner or This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //some number-theoretical utilities using naive algorithms suitable for small numbers #ifndef _NUMBERS_H_ #define _NUMBERS_H_ #include #include #include #include namespace LA { template N primefactor(const N &x); template bool isprime(const N &x) {return x>1 && x==primefactor(x);} template bool isoddprime(const N &x) {return x>2 && x==primefactor(x);} template class FACTORIZATION : public std::list > { }; template FACTORIZATION factorization(const N &x); template N nextprime(N x); template std::ostream & operator<<(std::ostream &s, const FACTORIZATION &x); template N eulerphi(const FACTORIZATION &f); template N eulerphi(const N &x) {return eulerphi(factorization(x));} template N pow(const N &x, N i); }//namespace #endif