I wrote: > Date: Fri, 17 Nov 2006 11:24:27 +0000 > Subject: Re: [Prime] Shifting the residue > > > Thankyou Steinar. > > It ain't "rocket science" but very pretty none the less. > I'll check it out on 2^11-1 in Basic when I feel like some programming > coming on:)
And here is my effort which works! DEFLNG A-Z p = 11 Mp = 2 ^ p - 1 RANDOMIZE TIMER shift = INT(RND * p) residue = (4 * 2 ^ shift) MOD Mp FOR n = 1 TO p - 2 shift = (2 * shift) MOD p residue = (residue ^ 2 + (Mp - 2) * 2 ^ shift) MOD Mp NEXT residue = (residue * 2 ^ (p - shift)) MOD Mp PRINT residue For p=11 it gives 1736 for all shifts, and zero for p=3,5,7,13 David Eddy _________________________________________________________________ Be one of the first to try Windows Live Mail. http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d _______________________________________________ Prime mailing list [email protected] http://hogranch.com/mailman/listinfo/prime
