View Single Post
Old 2007-05-28, 02:22   #27
geoff
 
geoff's Avatar
 
Mar 2003
New Zealand

100100001012 Posts
Default

Quote:
Originally Posted by Citrix View Post
2) in file bsgs.c, in function uint32_t setup64(uint64_t p), I wanted to add the following code. I tried returning j=0, so that the program would ignore this prime, but it did not work. What am I doing wrong?
Returning 0 from setup64(p) should cause the prime p to be skipped as you want. I think your problem is the array indexing, you declare
Code:
uint32_t modulus =(p-1)%POWER_RESIDUE_LCM;
uint32_t ar[POWER_RESIDUE_LCM/2]
then test
Code:
if(ar[(modulus/2)-1]==0)
but (modulus/2)-1 could take the value -1 ... ((POWER_RESIDUE_LCM-1)/2)-1
I think you just want to test
Code:
if(ar[modulus/2]==0)
Remember p-1 and POWER_RESIDUE_LCM can both be assumed to be even.
geoff is offline   Reply With Quote