Test_SigmaFactor Namespace Reference


Functions

def test_pmcheck_1
def test_pmcheck
def print_2_3_5_x_3_5_7
def test_2_3_5_x_3_5_7
def test_p_q_r
def new_test_q1_q2
def new_test

Variables

int verbose = 0
 prime = None
 powers = None
tuple tokens = re.split( "[p.]", arg )
tuple min = int( tokens[ 1 ] )
tuple max = int( tokens[ 2 ] )
string arg = "t12"
tuple o = SigmaFactor( 2, 47 )
tuple beg = time.time( )
tuple b = time.time( )
tuple r = SigmaFactor.SigmaFactor( prime, power )
tuple f = time.time( )
tuple fin = time.time( )

Function Documentation

def Test_SigmaFactor::new_test (  ) 

Definition at line 116 of file Test_SigmaFactor.py.

00116                :
00117     new_test_q1_q2( 8, 4 )
00118     new_test_q1_q2( 16, 4 )
00119     new_test_q1_q2( 6, 2 )
00120 
if __name__ == '__main__':

def Test_SigmaFactor::new_test_q1_q2 (   q1,
  q2 
)

Definition at line 103 of file Test_SigmaFactor.py.

00103                             :
00104 
00105     
00106     n1 = 2 ** q1 - 1
00107     n2 = 2 ** q2 - 1
00108     print "%d %d, %d %d, %d" % ( q1, n1, q2, n2, n1 / n2 )
00109     num = Factors.Factors( n1 )
00110     den = Factors.Factors( n2 )
00111     print "  num: %s %s" % ( num.__class__, num )
00112     print "  den: %s %s" % ( den.__class__, den )
00113     ans = num / den
00114     print "  ans: %s %s" % ( ans.__class__, ans )
00115     
def new_test( ):

def Test_SigmaFactor::print_2_3_5_x_3_5_7 (  ) 

Definition at line 51 of file Test_SigmaFactor.py.

00051                           :
00052     for p in ( 2, 3, 5):
00053         for q in ( 3, 5, 7):
00054             print "p,q:  %d,%d" % ( p, q ),
00055             f = F( p, q )
00056             s = f.sgmftr( )
00057             r = f.factor( s )
00058             print r
00059     # p,q:  2,3 (3, 1, 5, 1)
00060     # p,q:  2,5 (3, 2, 7, 1)
00061     # p,q:  2,7 (3, 1, 5, 1, 17, 1)
00062     # p,q:  3,3 (2, 3, 5, 1)
00063     # p,q:  3,5 (2, 2, 7, 1, 13, 1)
00064     # p,q:  3,7 (2, 4, 5, 1, 41, 1)
00065     # p,q:  5,3 (2, 2, 3, 1, 13, 1)
00066     # p,q:  5,5 (2, 1, 3, 2, 7, 1, 31, 1)
00067     # p,q:  5,7 (2, 3, 3, 1, 13, 1, 313, 1)
00068 
def test_2_3_5_x_3_5_7( ):

def Test_SigmaFactor::test_2_3_5_x_3_5_7 (  ) 

Definition at line 69 of file Test_SigmaFactor.py.

00069                          :
00070     ok = True
00071     ok &= test_p_q_r( 2, 3, [ 3, 1, 5, 1 ] )
00072     ok &= test_p_q_r( 2, 5, [ 3, 2, 7, 1 ] )
00073     ok &= test_p_q_r( 2, 7, [ 3, 1, 5, 1, 17, 1 ] )
00074     ok &= test_p_q_r( 3, 3, [ 2, 3, 5, 1 ] )
00075     ok &= test_p_q_r( 3, 5, [ 2, 2, 7, 1, 13, 1 ] )
00076     ok &= test_p_q_r( 3, 7, [ 2, 4, 5, 1, 41, 1 ] )
00077     ok &= test_p_q_r( 5, 3, [ 2, 2, 3, 1, 13, 1 ] )
00078     ok &= test_p_q_r( 5, 5, [ 2, 1, 3, 2, 7, 1, 31, 1 ] )
00079     ok &= test_p_q_r( 5, 7, [ 2, 3, 3, 1, 13, 1, 313, 1 ] )
00080     print "OK: %s" % ok
00081 
def test_p_q_r( p, q, r ):

def Test_SigmaFactor::test_p_q_r (   p,
  q,
  r 
)

Definition at line 82 of file Test_SigmaFactor.py.

00082                          :
00083     a = True
00084     f = SigmaFactor( p, q )
00085 
00086     o = f.sgmftr_old( )
00087     print "o: %s" % o.__class__
00088 
00089     n = f.sgmftr( )
00090     print "n: %s" % n.__class__
00091 
00092     if o != n:
00093         print "error - o: %s,  n: %s" % ( o, n )
00094         a = False
00095 #    if r != o:
00096 #        print "error - r: %s,  o: %s" % ( r, o )
00097 #        a = False
00098 #    if r != n:
00099 #        print "error - r: %s,  n: %s" % ( r, n )
00100 #        a = False
00101     return a
00102 
def new_test_q1_q2( q1, q2 ):

def Test_SigmaFactor::test_pmcheck (  ) 

Definition at line 24 of file Test_SigmaFactor.py.

00024                    :
00025     ok = True
00026 
00027 #    pmcheck - OK - 2 ** 47
00028 #                   [2351, 1, 4513, 1, 13264529, 1]
00029 
00030 
00031     exp = [ 2351, 1, 4513, 1, 13264529, 1 ]
00032     exp = Factors.Factors( 2 ** 47 - 1 )
00033     test_pmcheck_1( 2, 47, exp )
00034 
00035 #    pmcheck - OK - 2 ** 48
00036 #                   [7, 1, 3, 2, 65, 1, 4097, 1, 16777217, 1]
00037 
00038     exp = [ 7, 1, 3, 2, 65, 1, 4097, 1, 16777217, 1 ]
00039     exp = Factors.Factors( 2 ** 48 - 1 )
00040     test_pmcheck_1( 2, 48, exp )
00041 
00042 #    pmcheck - OK - 2 ** 49
00043 #                   [127, 1, 4432676798593, 1]
00044 
00045     exp = [ 127, 1, 4432676798593, 1 ]
00046     exp = Factors.Factors( 2 ** 49 - 1 )
00047     test_pmcheck_1( 2, 49, exp )
00048 
00049     print "test_pmcheck complete"
00050 
def print_2_3_5_x_3_5_7( ):

def Test_SigmaFactor::test_pmcheck_1 (   p,
  q,
  exp 
)

Definition at line 12 of file Test_SigmaFactor.py.

00012                                :
00013 
00014     act = SigmaFactor( p, q ).pmcheck( )
00015     print "a: %s" % act.__class__
00016     print "e: %s" % exp.__class__
00017     if act == exp:
00018         print "test_pmcheck -  %s %s - OK" % ( p, q )
00019     else:
00020         print "test_pmcheck error %s %s" % ( p, q )
00021         print "             act: %s" % act
00022         print "             exp: %s" % exp
00023 
def test_pmcheck( ):


Variable Documentation

string Test_SigmaFactor::arg = "t12"

Definition at line 147 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::b = time.time( )

Definition at line 171 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::beg = time.time( )

Definition at line 167 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::f = time.time( )

Definition at line 175 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::fin = time.time( )

Definition at line 179 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::max = int( tokens[ 2 ] )

Definition at line 142 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::min = int( tokens[ 1 ] )

Definition at line 141 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::o = SigmaFactor( 2, 47 )

Definition at line 163 of file Test_SigmaFactor.py.

Definition at line 126 of file Test_SigmaFactor.py.

Definition at line 125 of file Test_SigmaFactor.py.

Definition at line 174 of file Test_SigmaFactor.py.

tuple Test_SigmaFactor::tokens = re.split( "[p.]", arg )

Definition at line 135 of file Test_SigmaFactor.py.

Definition at line 10 of file Test_SigmaFactor.py.


Generated on Sun Mar 22 09:59:14 2009 for Multiperfect Number Generator by  doxygen 1.5.8