[Tutor] function value
Kermit Rose
kermit at polaris.net
Sun Aug 13 01:40:58 CEST 2006
A function in my factor package
return zeros instead of the correct value.
It did this for several times, and then returned the correct value.
I inserted print statements in the function and in the calling routine
which document this behavior.
The calling routine is function function fermat.
The function being called is function strongfac.
To see the test results , run the function testrange
with parameters
testrange(10**14+37,10**14+37).
Since it takes quite a lot of work to make a copy that survives the
email
removal of leading blanks
I attach the package of function routines here.
Results as run on my machine:
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32
Type "copyright", "credits" or "license()" for more information.
IDLE 1.1.2
>>> import factor34
>>> from factor34 import testrange
>>> testrange(10**14+37,10**14+37)
Begin calculating constants to be used in factoring.
Finished calculating constants to be used in factoring.
Search for a factor of 100000000000037
Could not find factors by strong probable prime test using witnesses <
10000.
Try to find factors by using power of 2 mod z as a witness.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 0 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 1 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 2 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 3 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 4 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 5 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 6 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 7 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 8 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 9 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 10 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 11 x = 0 y = 0 face = [0, 0, 0]
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 12 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 15306543515214
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 13 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 12123044576953
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 14 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 45391315949900
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 15 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 59571344259390
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 16 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 78029752396948
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 17 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 35863146075772
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 18 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 19712913203085
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 19 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 14607414373499
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 20 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 57761947468766
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 21 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 75604347243674
.
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
Retrieved from strongfac, face = [0, 0, 0]
In fermat: k = 22 x = 0 y = 0 face = [0, 0, 0]
In strongfac
Found1: x = 53799857
Found1: y = 1858741
face = [53799857L, 1858741L, 0]
Found1: factor by strong probable prime test, using witnes 3561873332543
Found1: factors are 53799857 1858741
Found1: returning [53799857L, 1858741L, 0] to fermat routine.
In strongfac
Found1: x = 1858741
Found1: y = 53799857
face = [1858741L, 53799857L, 0]
Found1: factor by strong probable prime test, using witnes 96058894729069
.
Found1: factors are 1858741 53799857
Found1: returning [1858741L, 53799857L, 0] to fermat routine.
Retrieved from strongfac, face = [1858741L, 53799857L, 0]
In fermat: k = 23 x = 1858741 y = 53799857 face = [1858741L,
53799857L, 0]
index of torial is 23
z = 100000000000037 x = 1858741 y = 53799857 difficulty = 0
>>>
Kermit Rose < kermit at polaris.net >
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: not available
Url: http://mail.python.org/pipermail/tutor/attachments/20060812/70aca486/attachment-0001.asc
More information about the Tutor
mailing list