#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <sstream>
#include <strstream>
#include <list>
#include <set>
#include <math.h>
#include <iomanip>
#include <string>
#include <algorithm>
#include <iterator>
#include <gmp.h>
#include <gmpxx.h>
using namespace std;
// const double my_pi = 4 * atan(1.0);
const double E_TO_THE_GAMMA = 1.7810724179901979852365 ;
const double GAMMA = 0.57721566490153286060 ;
const int BOUND = 1875;
// joseph.cc
// g++ -o// joseph joseph.cc -lgmp -lgmpxx
string stringify(int x)
{
ostringstream o;
o << x ;
return o.str();
}
string mp_Factored( mpz_class i)
{
// stringg++ fac;
-o facjoseph =joseph.cc " =-lgmp ";-lgmpxx
int p = 2;
mpz_class
temp = i;
if (temp <string 0stringify(int x)
{
temp *= -1; ostringstream o;
fac += " -1o *<< ";
x }
;
if ( 1 == temp return o.str();
fac += " 1 ";}
if ( temp
> 1)
{
int
primefac = 0;
while( temp
> 1 && pstring *mp_Factored( pmpz_class <= tempi)
{
ifstring (tempfac;
% fac = " = ";
int p === 2;
mpz_class temp = i;
if (temp < 0 )
{
++primefac;
temp *= -1;
if (primefac > 1) fac += " ";
-1 * ";
fac += stringify( p) ;}
temp /= p;
if ( 1 == temp) fac int+= exponent" =1 1;";
whileif (temp % ptemp ==> 01)
{
int tempprimefac /= p;
++exponent;0;
} // while p is fac
( temp > 1 && ifp (* exponentp ><= 1temp)
{
if (temp % p == 0)
{
++primefac;
if (primefac > 1) fac += "^"" ;";
fac += stringify( exponentp) ;
} temp /= p;
} // if int exponent = 1;
while (temp % p is== factor0)
++p; {
temp /= p;
++exponent;
} // while p is fac
if (temp exponent > 1)
&& primefac >= 1) {
fac += ""^" ";;
if (temp > 1 ) fac += stringify( temp.get_ui()exponent) ;
} // temp > 1
return fac; }
} // mp_Factored
if p is factor
// g++ -o joseph joseph.cc -lgmp -lgmpxx
++p;
mpz_class intpow(int n, int k)
{
} // mpz_classwhile blobp
= 1;
for(int j = 1;if j(temp <=> k;1 ++j&& primefac >= 1) blobfac *=+= n;
" ";
return ( blob );
}
mpz_class orourkeif (temp mpz_class> i1 )
{
fac mpz_class+= joestringify( =temp.get_ui()) 1;
;
int p = 2;
} mpz_class// temp => i;1
if (temp < 0 )
return {fac;
temp} *=// -1;mp_Factored
}
if ( temp// > 1)
g++ {-o joseph joseph.cc -lgmp -lgmpxx
while(
temp > 1 && pmpz_class * pintpow(int <=n, tempint k)
{
if mpz_class blob = 1;
for(tempint %j = 1; j <= k; ++j) blob *= n;
return ( blob );
}
mpz_class orourke( mpz_class i)
{
mpz_class joe = 1;
int p === 2;
mpz_class temp = i;
if (temp < 0 )
{
temp /= p;
int exponent =*= -1;
while (temp % p == 0)}
{
if ( temp /=> p;1)
++exponent;{
} // while p is fac
while( temp > 1 && ifp (* exponentp ><= 1temp)
{
joe *= exponent ;
}
} // if p is factor
++p;
} // while p
} // temp > 1
return joe;
} // orourke
// g++ -o joseph joseph.cc -lgmp -lgmpxx
int main()
{
ofstream erasefile("joseph.txt");
erasefile.close();
double luge = 0.0;
double luge_boundtemp =% 270.0;p == //270.0)
// product of exponents
for( int e2 = 2; e2 * log(2.0) < luge_bound ; ++e2){
mpz_class p2 = intpow(2, e2) ;
double luge2 = e2 * log(2.0) ;
temp // cerr << "2^" << e2 << endl;
for( int e3 = 0; e3 <= e2 && luge2 + e3 * log(3.0) < luge_bound ; ++e3){
mpz_class p3 = p2 * intpow(3, e3) ;
double luge3 = luge2 + e3 * log(3.0) ;
p;
// cerr << "2^" << e2 << " 3^" << e3 << endl;
for( int e5exponent = 0; e5 <= e3 && luge3 + e5 * log(5.0) < luge_bound ; ++e5){1;
mpz_class p5 = p3 * while intpow(5, e5) ;
double luge5 = luge3temp +% e5p *== log(5.0) ;
// cerr << "2^" << e2 << " 3^" << e3 << " 5^" << e5 << endl;
for( int e7 = 0; e7 <= e5 && luge5 + e7 * log(7.0) < luge_bound ; ++e7){
mpz_class p7 = p5 * intpow(7, e7) ;
double luge7temp /= luge5 + e7 * log(7.0) ;
p;
cerr << "2^" << e2 << " 3^" << e3 << " 5^" << e5 << " 7^" << e7 << endl;
system("date");++exponent;
cout << endl;
for( int e11 = 0; e11 <= e7 && luge7 + e11 * log(11.0) <} // luge_boundwhile p ;is ++e11){fac
mpz_class p11 = p7 * if intpow(11, e11) ;
double luge11 = luge7 + e11exponent *> log(11.01) ;
for( int e13 = 0; e13 <= e11 && luge11 + e13 * log(13.0) < luge_bound ; ++e13){
mpz_class p13 = p11 * intpow(13, e13) ;
double luge13 = luge11 + e13 * log(13.0) ;
for( int e17 = 0; e17 <= e13 && luge13 + e17 * log(17.0) < joe luge_bound*= exponent ; ++e17){
mpz_class p17 = p13 * intpow(17, e17) ;}
double luge17 = luge13 +} e17 *// log(17.0)if p ;is
factor
for( int e19 = 0; e19 <= e17 && luge17 + e19 * log(19.0) < luge_bound ; ++e19){++p;
mpz_class p19 = p17 * } intpow(19,// e19)while ;p
double luge19 = luge17 + e19 * log(19.0) ;
for( int e23 = 0; e23 <= e19 && luge19 + e23 * log(23.0) < } luge_bound// temp ;> ++e23){1
mpz_class p23 = p19 * intpow(23, e23)return ;joe;
double luge23 = luge19 + e23 * log(23.0) } ;// orourke
for( int e29 = 0; e29 <= e23 && luge23 + e29 * log(29.0) < luge_bound ; ++e29){
mpz_class p29 = p23 * intpow(29, e29) ;
double luge29 = luge23 + e29 * log(29.0) ;
for( int e31 = 0; e31 <= e29 && luge29 + e31 * log(31.0) < luge_bound ; ++e31){
mpz_class p31 = p29 * intpow(31, e31) ;
double luge31 = luge29 + e31 * log(31.0) ;
for( int e37 = 0; e37 <= e31 && luge31 + e37 * log(37.0) < luge_bound ; ++e37){
mpz_class p37 = p31 * intpow(37, e37) ;
double luge37 = luge31 + e37 * log(37.0) ;
for( int e41 = 0; e41 <= e37 && luge37 + e41 * log(41.0) < luge_bound ; ++e41){
mpz_class p41 = p37 * intpow(41, e41) ;
double luge41 = luge37 + e41 * log(41.0) ;
for( int e43 = 0; e43 <= e41 && luge41 + e43 * log(43.0) < luge_bound ; ++e43){
mpz_class p43 = p41 * intpow(43, e43) ;
double luge43 = luge41 + e43 * log(43.0) ;
for( int e47 = 0; e47 <= e43 && luge43 + e47 * log(47.0) < luge_bound ; ++e47){
mpz_class p47 = p43 * intpow(47, e47) ;
double luge47 = luge43 + e47 * log(47.0) ;
for( int e53 = 0; e53 <= e47 && luge47 + e53 * log(53.0) < luge_bound ; ++e53){
mpz_class p53 = p47 * intpow(53, e53) ;
double luge53 = luge47 + e53 * log(53.0) ;
for( int e59 = 0; e59 <= e53 && luge53 + e59 * log(59.0) < luge_bound ; ++e59){
mpz_class p59 = p53 * intpow(59, e59) ;
double luge59 = luge53 + e59 * log(59.0) ;
for( int e61 = 0; e61 <= e59 && luge59 + e61 * log(61.0) < luge_bound ; ++e61){
mpz_class p61 = p59 * intpow(61, e61) ;
double luge61 = luge59 + e61 * log(61.0) ;
for( int e67 = 0; e67 <= e61 && luge61 + e67 * log(67.0) < luge_bound ; ++e67){
mpz_class p67 = p61 * intpow(67, e67) ;
double luge67 = luge61 + e67 * log(67.0) ;
for( int e71 = 0; e71 <= e67 && luge67 + e71 * log(71.0) < luge_bound ; ++e71){
mpz_class p71 = p67 * intpow(71, e71) ;
double luge71 = luge67 + e71 * log(71.0) ;
for( int e73 = 0; e73 <= e71 && luge71 + e73 * log(73.0) < luge_bound ; ++e73){
mpz_class p73 = p71 * intpow(73, e73) ;
double luge73 = luge71 + e73 * log(73.0) ;
for( int e79 = 0; e79 <= e73 && luge73 + e79 * log(79.0) < luge_bound ; ++e79){
mpz_class p79 = p73 * intpow(79, e79) ;
double luge79 = luge73 + e79 * log(79.0) ;
for( int e83 = 0; e83 <= e79 && luge79 + e83 * log(83.0) < luge_bound ; ++e83){
mpz_class p83 = p79 * intpow(83, e83) ;
double luge83 = luge79 + e83 * log(83.0) ;
for( int e89 = 0; e89 <= e83 && luge83 + e89 * log(89.0) < luge_bound ; ++e89){
mpz_class p89 = p83 * intpow(89, e89) ;
double luge89 = luge83 + e89 * log(89.0) ;
for( int e97 = 0; e97 <= e89 && luge89 + e97 * log(97.0) < luge_bound ; ++e97){
mpz_class p97 = p89 * intpow(97, e97) ;
double luge97 = luge89 + e97 * log(97.0) ;
for( int e101 = 0; e101 <= e97 && luge97 + e101 * log(101.0) < luge_bound ; ++e101){
mpz_class p101 = p97 * intpow(101, e101) ;
double luge101 = luge97 + e101 * log(101.0) ;
for( int e103 = 0; e103 <= e101 && luge101 + e103 * log(103.0) < luge_bound ; ++e103){
mpz_class p103 = p101 * intpow(103, e103) ;
double luge103 = luge101 + e103 * log(103.0) ;
for( int e107 = 0; e107 <= e103 && luge103 + e107 * log(107.0) < luge_bound ; ++e107){
mpz_class p107 = p103 * intpow(107, e107) ;
double luge107 = luge103 + e107 * log(107.0) ;
for( int e109 = 0; e109 <= e107 && luge107 + e109 * log(109.0) < luge_bound ; ++e109){
mpz_class p109 = p107 * intpow(109, e109) ;
double luge109 = luge107 + e109 * log(109.0) ;
for( int e113 = 0; e113 <= e109 && luge109 + e113 * log(113.0) < luge_bound ; ++e113){
mpz_class p113 = p109 * intpow(113, e113) ;
double luge113 = luge109 + e113 * log(113.0) ;
for( int e127 = 0; e127 <= e113 && luge113 + e127 * log(127.0) < luge_bound ; ++e127){
mpz_class p127 = p113 * intpow(127, e127) ;
double luge127 = luge113 + e127 * log(127.0) ;
for( int e131 = 0; e131 <= e127 && luge127 + e131 * log(131.0) < luge_bound ; ++e131){
mpz_class p131 = p127 * intpow(131, e131) ;
double luge131 = luge127 + e131 * log(131.0) ;
for( int e137 = 0; e137 <= e131 && luge131 + e137 * log(137.0) < luge_bound ; ++e137){
mpz_class p137 = p131 * intpow(137, e137) ;
double luge137 = luge131 + e137 * log(137.0) ;
for( int e139 = 0; e139 <= e137 && luge137 + e139 * log(139.0) < luge_bound ; ++e139){
mpz_class p139 = p137 * intpow(139, e139) ;
double luge139 = luge137 + e139 * log(139.0) ;
for( int e149 = 0; e149 <= e139 && luge139 + e149 * log(149.0) < luge_bound ; ++e149){
mpz_class p149 = p139 * intpow(149, e149) ;
double luge149 = luge139 + e149 * log(149.0) ;
// g++ -o joseph joseph.cc -lgmp -lgmpxx
mpz_class p = p149;
double luge = luge149;
if ( orourke(orourke(orourke(orourke(orourke(p))))) != 1 && int orourke(orourke(orourke(orourke(orourke(orourkemain(p)))))) == 1 && luge < luge_bound )
{
cout <<ofstream erasefile("joseph.txt");
setw erasefile.close(12);
<<
// double luge = 0.0; // declared later although compile did not complain
double luge_bound = 270.0; //270.0
// product of exponents
for( int e2 = 2; e2 * log(102.0) <<< " luge_bound " ; <<++e2){
p << mp_Factored mpz_class p2 = intpow(p2, e2) <<;
" " << orourke double luge2 = e2 * log(p2.0) ;
// cerr << "2^" << e2 << endl;
luge_bound for( int e3 = luge;0; e3 <= e2 && luge2 + e3 * log(3.0) < luge_bound ; ++e3){
mpz_class p3 = p2 * intpow(3, e3) ;
double ofstreamluge3 outfile= luge2 + e3 * log("joseph3.txt",ios::app0) ;
outfile// cerr << "2^" setw<< e2 << " 3^" << e3 << endl;
for(12 int e5 = 0; e5 <= e3 && luge3 + e5 * log(5.0) <<< luge /luge_bound ; ++e5){
mpz_class p5 = p3 * intpow(5, e5) ;
double luge5 = luge3 + e5 * log(105.0) ;
// cerr << "2^" << e2 << " 3^" << e3 << " 5^" << pe5 << mp_Factoredendl;
for(p int e7 = 0; e7 <= e5 && luge5 + e7 * log(7.0) < luge_bound ; ++e7){
mpz_class p7 = p5 * intpow(7, e7) ;
double luge7 = luge5 + e7 * log(7.0) ;
cerr << "2^" << e2 << " 3^" << e3 << " 5^" << e5 orourke<< " 7^" << e7 << endl;
system(p"date");
<< " " cout << endl;
orourke
for(orourke int e11 = 0; e11 <= e7 && luge7 + e11 * log(p11.0) < luge_bound ; ++e11){
<< endl; mpz_class p11 = p7 * intpow(11, e11) ;
double luge11 = luge7 + e11 * log(11.0) ;
for( int e13 = 0; e13 <= e11 && luge11 + e13 * log(13.0) < luge_bound ; ++e13){
mpz_class p13 = p11 * intpow(13, e13) ;
double luge13 = luge11 + e13 * log(13.0) ;
for( int e17 = 0; e17 <= e13 && luge13 + e17 * log(17.0) < luge_bound ; ++e17){
mpz_class p17 = p13 * intpow(17, e17) ;
double luge17 = luge13 + e17 * log(17.0) ;
for( int e19 = 0; e19 <= e17 && luge17 + e19 * log(19.0) < luge_bound ; ++e19){
mpz_class p19 = p17 * intpow(19, e19) ;
double luge19 = luge17 + e19 * log(19.0) ;
for( int e23 = 0; e23 <= e19 && luge19 + e23 * log(23.0) < luge_bound ; ++e23){
mpz_class p23 = p19 * intpow(23, e23) ;
double luge23 = luge19 + e23 * log(23.0) ;
outfile.close(); // close quickly save partial progress
system("date >> joseph.txt") ;
} // if
} // 149
} // 139
} // 137
} // 131
} // 127
} // 113
} // 109
} // 107
} // 103
} // 101
} // 97
} // 89
} // 83
} // 79
} // 73
} // 71
} // 67
} // 61
} // 59
} // 53
} // 47
} // 43
} // 41
} // 37
} // 31
} // 29
} // 23
} // 19
} // 17
} // 13
} // 11
} // 7
} // 5
} // 3
} // 2
return 0 ;
}
for( int e29 = 0; e29 <= e23 && luge23 + e29 * log(29.0) < luge_bound ; ++e29){
mpz_class p29 = p23 * intpow(29, e29) ;
double luge29 = luge23 + e29 * log(29.0) ;
for( int e31 = 0; e31 <= e29 && luge29 + e31 * log(31.0) < luge_bound ; ++e31){
mpz_class p31 = p29 * intpow(31, e31) ;
double luge31 = luge29 + e31 * log(31.0) ;
for( int e37 = 0; e37 <= e31 && luge31 + e37 * log(37.0) < luge_bound ; ++e37){
mpz_class p37 = p31 * intpow(37, e37) ;
double luge37 = luge31 + e37 * log(37.0) ;
for( int e41 = 0; e41 <= e37 && luge37 + e41 * log(41.0) < luge_bound ; ++e41){
mpz_class p41 = p37 * intpow(41, e41) ;
double luge41 = luge37 + e41 * log(41.0) ;
for( int e43 = 0; e43 <= e41 && luge41 + e43 * log(43.0) < luge_bound ; ++e43){
mpz_class p43 = p41 * intpow(43, e43) ;
double luge43 = luge41 + e43 * log(43.0) ;
for( int e47 = 0; e47 <= e43 && luge43 + e47 * log(47.0) < luge_bound ; ++e47){
mpz_class p47 = p43 * intpow(47, e47) ;
double luge47 = luge43 + e47 * log(47.0) ;
for( int e53 = 0; e53 <= e47 && luge47 + e53 * log(53.0) < luge_bound ; ++e53){
mpz_class p53 = p47 * intpow(53, e53) ;
double luge53 = luge47 + e53 * log(53.0) ;
for( int e59 = 0; e59 <= e53 && luge53 + e59 * log(59.0) < luge_bound ; ++e59){
mpz_class p59 = p53 * intpow(59, e59) ;
double luge59 = luge53 + e59 * log(59.0) ;
for( int e61 = 0; e61 <= e59 && luge59 + e61 * log(61.0) < luge_bound ; ++e61){
mpz_class p61 = p59 * intpow(61, e61) ;
double luge61 = luge59 + e61 * log(61.0) ;
for( int e67 = 0; e67 <= e61 && luge61 + e67 * log(67.0) < luge_bound ; ++e67){
mpz_class p67 = p61 * intpow(67, e67) ;
double luge67 = luge61 + e67 * log(67.0) ;
for( int e71 = 0; e71 <= e67 && luge67 + e71 * log(71.0) < luge_bound ; ++e71){
mpz_class p71 = p67 * intpow(71, e71) ;
double luge71 = luge67 + e71 * log(71.0) ;
for( int e73 = 0; e73 <= e71 && luge71 + e73 * log(73.0) < luge_bound ; ++e73){
mpz_class p73 = p71 * intpow(73, e73) ;
double luge73 = luge71 + e73 * log(73.0) ;
for( int e79 = 0; e79 <= e73 && luge73 + e79 * log(79.0) < luge_bound ; ++e79){
mpz_class p79 = p73 * intpow(79, e79) ;
double luge79 = luge73 + e79 * log(79.0) ;
for( int e83 = 0; e83 <= e79 && luge79 + e83 * log(83.0) < luge_bound ; ++e83){
mpz_class p83 = p79 * intpow(83, e83) ;
double luge83 = luge79 + e83 * log(83.0) ;
for( int e89 = 0; e89 <= e83 && luge83 + e89 * log(89.0) < luge_bound ; ++e89){
mpz_class p89 = p83 * intpow(89, e89) ;
double luge89 = luge83 + e89 * log(89.0) ;
for( int e97 = 0; e97 <= e89 && luge89 + e97 * log(97.0) < luge_bound ; ++e97){
mpz_class p97 = p89 * intpow(97, e97) ;
double luge97 = luge89 + e97 * log(97.0) ;
for( int e101 = 0; e101 <= e97 && luge97 + e101 * log(101.0) < luge_bound ; ++e101){
mpz_class p101 = p97 * intpow(101, e101) ;
double luge101 = luge97 + e101 * log(101.0) ;
for( int e103 = 0; e103 <= e101 && luge101 + e103 * log(103.0) < luge_bound ; ++e103){
mpz_class p103 = p101 * intpow(103, e103) ;
double luge103 = luge101 + e103 * log(103.0) ;
for( int e107 = 0; e107 <= e103 && luge103 + e107 * log(107.0) < luge_bound ; ++e107){
mpz_class p107 = p103 * intpow(107, e107) ;
double luge107 = luge103 + e107 * log(107.0) ;
for( int e109 = 0; e109 <= e107 && luge107 + e109 * log(109.0) < luge_bound ; ++e109){
mpz_class p109 = p107 * intpow(109, e109) ;
double luge109 = luge107 + e109 * log(109.0) ;
for( int e113 = 0; e113 <= e109 && luge109 + e113 * log(113.0) < luge_bound ; ++e113){
mpz_class p113 = p109 * intpow(113, e113) ;
double luge113 = luge109 + e113 * log(113.0) ;
for( int e127 = 0; e127 <= e113 && luge113 + e127 * log(127.0) < luge_bound ; ++e127){
mpz_class p127 = p113 * intpow(127, e127) ;
double luge127 = luge113 + e127 * log(127.0) ;
for( int e131 = 0; e131 <= e127 && luge127 + e131 * log(131.0) < luge_bound ; ++e131){
mpz_class p131 = p127 * intpow(131, e131) ;
double luge131 = luge127 + e131 * log(131.0) ;
for( int e137 = 0; e137 <= e131 && luge131 + e137 * log(137.0) < luge_bound ; ++e137){
mpz_class p137 = p131 * intpow(137, e137) ;
double luge137 = luge131 + e137 * log(137.0) ;
for( int e139 = 0; e139 <= e137 && luge137 + e139 * log(139.0) < luge_bound ; ++e139){
mpz_class p139 = p137 * intpow(139, e139) ;
double luge139 = luge137 + e139 * log(139.0) ;
for( int e149 = 0; e149 <= e139 && luge139 + e149 * log(149.0) < luge_bound ; ++e149){
mpz_class p149 = p139 * intpow(149, e149) ;
double luge149 = luge139 + e149 * log(149.0) ;
// g++ -o joseph joseph.cc -lgmp -lgmpxx
mpz_class p = p149;
double luge = luge149;
if ( orourke(orourke(orourke(orourke(orourke(p))))) != 1 && orourke(orourke(orourke(orourke(orourke(orourke(p)))))) == 1 && luge < luge_bound )
{
cout << setw(12) << luge / log(10.0) << " " << p << mp_Factored(p) << " " << orourke(p) << endl;
luge_bound = luge;
ofstream outfile("joseph.txt",ios::app);
outfile << setw(12) << luge / log(10.0) << " " << p << mp_Factored(p) << " " << orourke(p) << " " << orourke(orourke(p)) << endl;
outfile.close(); // close quickly save partial progress
system("date >> joseph.txt") ;
} // if
} // 149
} // 139
} // 137
} // 131
} // 127
} // 113
} // 109
} // 107
} // 103
} // 101
} // 97
} // 89
} // 83
} // 79
} // 73
} // 71
} // 67
} // 61
} // 59
} // 53
} // 47
} // 43
} // 41
} // 37
} // 31
} // 29
} // 23
} // 19
} // 17
} // 13
} // 11
} // 7
} // 5
} // 3
} // 2
return 0 ;
}