mersenneforum.org Another failing 1-liner
 Register FAQ Search Today's Posts Mark Forums Read

 2022-11-12, 16:54 #1 jnml   Feb 2012 Prague, Czech Republ 3×67 Posts Another failing 1-liner Code: ? forprime(p=3,37,m=1<
2022-11-12, 17:28   #2
science_man_88

"Forget I exist"
Jul 2009
Dartmouth NS

2×3×23×61 Posts

Quote:
 Originally Posted by jnml Code: ? forprime(p=3,37,m=1<
Is it supposedly to be 1<<(p-1) ??

2022-11-12, 18:26   #3
jnml

Feb 2012
Prague, Czech Republ

3×67 Posts

Quote:
 Originally Posted by science_man_88 Is it supposedly to be 1<<(p-1) ??
AFAICT $$p-2$$ is correct. It's about solving the old $$x^2+x+1=0 \pmod {m_p}$$ again. (Completing the square produces $$n$$ on the RHS.)

? forprime(p=3,31,print(p);m=1<<p-1;n=1<<(p-1)-1;for(i=1,n,if(issquare(n),print(p);break);n+=m))
3
5
7
11
13
17
19
23
29
31
? ##
*** last result: cpu time 4min, 35,941 ms, real time 4min, 36,209 ms.
?

 2022-11-12, 21:15 #4 RMLabrador   "Chereztynnoguzakidai" Oct 2022 Ukraine, near Kyiv. 53 Posts in the Hell, the Satan-machine exist, for coders (severe cases) one rotation by right or left arm, the one step of cycle gone, all steps - you are free. Be careful with 1-liners, I rotated it, I know...
2022-11-12, 21:34   #5
chalsall
If I May

"Chris Halsall"
Sep 2002

3×5×739 Posts

Quote:
 Originally Posted by RMLabrador Be careful with 1-liners, I rotated it, I know...
I was always taught to simply manage the situation. As best as one can.

Read deeply. Use critical thought. Use the scientific method. Question everything; including oneself.

Understand the concept of deliberate noise meant to distract. Have thick skin. It's OK to be incorrect. It's also OK to be correct when everyone else thinks you are incorrect.

If I may... I will never be able to thank my teachers enough.

We are all students.

8^)

 2022-11-14, 07:24 #6 jnml   Feb 2012 Prague, Czech Republ 3×67 Posts it can be "fixed" $$M_{p-2}^{M_{p-1}} \equiv 1 \pmod {M_p}$$ Code: `? m(p)=1<1<

 Similar Threads Thread Thread Starter Forum Replies Last Post mgeisert GMP-ECM 2 2022-05-12 08:45 pinhodecarlos Msieve 7 2018-11-09 21:54 ATH Programming 4 2017-06-08 22:22 zenzu88 Software 2 2012-04-10 15:16 jugbugs Hardware 12 2004-03-25 02:37

All times are UTC. The time now is 14:31.

Sat Feb 4 14:31:43 UTC 2023 up 170 days, 12 hrs, 1 user, load averages: 0.84, 0.87, 0.88