mersenneforum.org Possible obfuscation for Mersennes
 Register FAQ Search Today's Posts Mark Forums Read

 2019-01-23, 21:44 #1 paulunderwood     Sep 2002 Database er0rr 2·1,697 Posts Possible obfuscation for Mersennes Carried out on an idle Pi Zero W: Code: ? gettime();p=21701;n=2^p-1;e=n;r=Mod(3,n)^((e))-3;print([length(e),lift(r)]);gettime() [679, 0] 54996 ? gettime();p=21701;n=2^p-1;e=lift(Mod(2,n-1)^(p-1));r=Mod(3,n)^((e))+3;print([length(e),lift(r)]);gettime() [679, 0] 54455
2019-01-23, 22:10   #2
paulunderwood

Sep 2002
Database er0rr

2×1,697 Posts

Quote:
 Originally Posted by paulunderwood Carried out on an idle Pi Zero W: Code: ? gettime();p=21701;n=2^p-1;e=n;r=Mod(3,n)^((e))-3;print([length(e),lift(r)]);gettime() [679, 0] 54996 ? gettime();p=21701;n=2^p-1;e=lift(Mod(2,n-1)^(p-1));r=Mod(3,n)^((e))+3;print([length(e),lift(r)]);gettime() [679, 0] 54455
Oh this is poor. I should have used e=n+1. Other than this the test was 3^((n+1)/2)+3 == 0 (mod n)

2019-01-23, 22:10   #3
R. Gerbicz

"Robert Gerbicz"
Oct 2005
Hungary

7·199 Posts

Quote:
 Originally Posted by paulunderwood Carried out on an idle Pi Zero W: Code: ? gettime();p=21701;n=2^p-1;e=n;r=Mod(3,n)^((e))-3;print([length(e),lift(r)]);gettime() [679, 0] 54996 ? gettime();p=21701;n=2^p-1;e=lift(Mod(2,n-1)^(p-1));r=Mod(3,n)^((e))+3;print([length(e),lift(r)]);gettime() [679, 0] 54455
Not surprising, in the 1st case e=2^p-1, while in the 2nd case e=2^(p-1) and that enables a simple repeated squaring at powmod. Actually we're doing the 2nd variant with error checking, probably it is better to do 3^(2^p) mod mp to allow a fast space efficient cofactor test for mp/d.

 2019-01-24, 03:14 #4 CRGreathouse     Aug 2006 31×191 Posts Incidentally, rather than Code: ? gettime(); foo; print(bar); gettime() I would write Code: ? # ? foo; bar where # turns the timer on (or off). In your case this would have resulted in Code: ? # timer = 1 (on) ? p=21701;n=2^p-1;e=n;r=Mod(3,n)^((e))-3;[length(e),lift(r)] time = 54,996 ms. %1 = [679, 0] ? p=21701;n=2^p-1;e=lift(Mod(2,n-1)^(p-1));r=Mod(3,n)^((e))+3;[length(e),lift(r)] time = 54,455 ms. %2 = [679, 0] (Apologies if this was known/obvious.)

 Similar Threads Thread Thread Starter Forum Replies Last Post lukerichards Software 8 2018-01-24 22:30 CRGreathouse Lounge 10 2016-03-31 13:41 Uncwilly GPU Computing 29 2013-09-08 20:53 David John Hill Jr Science & Technology 2 2009-12-13 09:47 Citrix Miscellaneous Math 2 2005-10-04 08:08

All times are UTC. The time now is 15:12.

Sun Sep 20 15:12:13 UTC 2020 up 10 days, 12:23, 1 user, load averages: 1.90, 1.73, 1.55