mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Miscellaneous Math

Reply
 
Thread Tools
Old 2022-11-12, 16:54   #1
jnml
 
Feb 2012
Prague, Czech Republ

3×67 Posts
Default Another failing 1-liner

Code:
? forprime(p=3,37,m=1<<p-1;n=1<<(p-2)-1;for(i=1,n,if(issquare(n),print(p);break);n+=m))
3
5
7
13
17
19
31
37
? ##
  ***   last result: cpu time 1min, 32,968 ms, real time 1min, 32,988 ms.
?
jnml is offline   Reply With Quote
Old 2022-11-12, 17:28   #2
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dartmouth NS

2·3·23·61 Posts
Default

Quote:
Originally Posted by jnml View Post
Code:
? forprime(p=3,37,m=1<<p-1;n=1<<(p-2)-1;for(i=1,n,if(issquare(n),print(p);break);n+=m))
3
5
7
13
17
19
31
37
? ##
  ***   last result: cpu time 1min, 32,968 ms, real time 1min, 32,988 ms.
?
Is it supposedly to be 1<<(p-1) ??
science_man_88 is online now   Reply With Quote
Old 2022-11-12, 18:26   #3
jnml
 
Feb 2012
Prague, Czech Republ

3·67 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
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.
?
jnml is offline   Reply With Quote
Old 2022-11-12, 21:15   #4
RMLabrador
 
"Chereztynnoguzakidai"
Oct 2022
Ukraine, near Kyiv.

53 Posts
Default

in the Hell, the Satan-machine exist, for coders (severe cases)
Click image for larger version

Name:	1217px-Gosremprom.jpg
Views:	31
Size:	324.0 KB
ID:	27618
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...
RMLabrador is offline   Reply With Quote
Old 2022-11-12, 21:34   #5
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

3×5×739 Posts
Default

Quote:
Originally Posted by RMLabrador View Post
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^)
chalsall is offline   Reply With Quote
Old 2022-11-14, 07:24   #6
jnml
 
Feb 2012
Prague, Czech Republ

3118 Posts
Default it can be "fixed"

\(M_{p-2}^{M_{p-1}} \equiv 1 \pmod {M_p}\)

Code:
? m(p)=1<<p-1
%1 = (p)->1<<p-1
? forprime(p=3,4423,if(Mod(m(p-2),m(p))^m(p-1)==1,print(p)))
3
5
7
13
17
19
31
61
89
107
127
521
607
1279
2203
2281
3217
4253
4423
? ##
  ***   last result: cpu time 3,518 ms, real time 3,519 ms.
?
But that's Euler all over again, isn't it?
jnml is offline   Reply With Quote
Reply

Thread Tools


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

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


Sat Feb 4 14:43:47 UTC 2023 up 170 days, 12:12, 1 user, load averages: 0.64, 0.87, 0.88

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔