20200318, 13:19  #34  
Nov 2017
Karlsruhe, Germany
1F_{16} Posts 
Quote:
Quote:
I never claimed that it would make sense to do so. I am doing it because I enjoy playing with numbers. And also because I want to practise optimizing things in Java. Because that's part of my job. And all those things are irrelevant to the underlying math question. Quote:
But in turn let me ask you this: What is your (all) obsession with essentially telling me I'm not allowed to (or shouldn't) do things I enjoy for the sake of doing them? I mean think about it. The entire premisse of this forum is based on a futile matter. Finding Mersenne Primes has no merrit to it other than creating utterly obscure knowledge that most likely will never be relevant. And why do people do that? Because they enjoy doing it or because they are curious. The exact same applies to what I am doing. Now you might say things like "But math is math. Every bit of knowledge is valuable. And one day it might be important". And to that I say "Rightfully so. And knowing which way to implement LL using Java's BigInteger is the fastest is exactly the same." Or "While doing so many important things have been discovered along the way". And my response would be that the same applies to my case. Even if only I learn doing it. And regarding R.D. Silverman's answer: I asked a yesno question (does such a case exist). And the reply was a mathematical explanation that I don't understand. So while this may be answer to you, it isn't to me. I can't tell if their answer means "Yes, such cases are possible" or "No. No such cases are possible". Though if I had to guess, it's a yes and that we haven't found any such cases so far. But I get it. Uneducated people are not welcome here and neither are people that enjoy doing "futile" things for the sake of it. 

20200318, 13:37  #35  
Jun 2003
11F0_{16} Posts 
Quote:
Anyway, do you want to know what's funny about your concerns with encountering negative numbers? It doesn't matter! Java biginteger uses signed integers, and so even if you run into negative numbers, the squaring operation in the next iteration will still give you correct value! Try it. One thing that bugs me though. You said that S.multiply(S).mod(M_p).subtract(2).mod(M_p) benchmarked a little bit faster than S.multiply(S).mod(M_p).subtract(2). Since the former does strictly more operations than the latter, I have to assume that perhaps your benchmarking is somehow flawed. Maybe they're close enough that you're measuring statistical variation, but I can't believe that the first one can ever be faster than the second. 

20200318, 13:41  #36 
Mar 2007
Estonia
2^{2}·3·11 Posts 
Doing some backofthenapkin math here, which might not be correct  I am not a mathematician, but a software engineer.
We have N=2^n1. Let's assume n "tries" to get 1 as a result of the mod operation. The result can be 0..N.. So every single try has 1/N chance of being 1. (I am leaving out the fact that the result first has to reach N) So the chance of a candidate becoming 1 is roughly: 1/(2^n)*n This chance becomes miniscule very quickly, eg. n=64 is circa 10^18. n=128 is circa 10^37 So it's practically impossible to hit that condition. Am I right? Last fiddled with by kuratkull on 20200318 at 13:50 
20200318, 14:12  #37  
Nov 2017
Karlsruhe, Germany
11111_{2} Posts 
Quote:
There's a saying that if you don't have anything nice or constructive to say, don't say anything. And critizing me for using an inefficient (in the grand scheme of things) method of doing things when absolute efficiency isn't a concern of mine is not constructive. And said point has been repeated numerous times already. Quote:
And while I initially doubted that it could matter at all, I wasn't sure initially, so I wanted to have test cases that covered it. So I am aware that this discussion only has a pure mathematical value left, which is makes me disagree even more with the decision to merge the threads and move it into Programming, where it now is severely misplaced. Quote:


20200318, 14:13  #38  
Nov 2003
2^{3}·3^{2}·103 Posts 
Quote:
modular arithmetic. In particular you did not listen to my discussion about representations. Arithmetic mod N can never yield a result that is in [0,.....N] because N is not part of the representation. It can be [0,....N1]. Because, trivially N mod N equals 0. When working mod N the expression [0,....N] is not a set. It is a multiset. Secondly, your assertion that "The result can be 0..N.. So every single try has 1/N chance of being 1." is also wrong. There are N+1 elements in 0,....N , not N. Your statement also assumes a uniform pdf which assuredly it is NOT. You are a software engineer trying to implement an algorithm whose correct implementation requires knowing a lot of math. Multiple people have told you that the "2" is irrelevant to the runtime. Yet you continue to argue with them. Quote:
iteration". Your assertion is totally wrong. If N = 2^p1 is prime the probability is zero. If N is composite the probability depends on the factors of N+1 and the structure of the subgroups of the twisted group, i.e. it depends on the number of elements whose order is r for r less than the full order. The values of r depend on the factors of N+1. Quote:
You state that you are not a mathematician, yet you make mathematical pronouncements when you don't know the math. I call that arrogant. Stop making pronouncements and start listening. You will need to learn some modern algebra, some number theory, and some statistical theory. Last fiddled with by R.D. Silverman on 20200318 at 14:16 Reason: pagination 

20200318, 14:16  #39  
Nov 2017
Karlsruhe, Germany
1F_{16} Posts 
Quote:
Though as pointed out, programmically speaking it's a non concern. So now I'm just genuinely curious as to whether or not those cases might exist. Last fiddled with by BrainStone on 20200318 at 14:18 

20200318, 14:21  #40  
Nov 2017
Karlsruhe, Germany
31_{10} Posts 
Quote:


20200318, 14:21  #41  
Bamboozled!
May 2003
Down not across
10011100001000_{2} Posts 
Quote:
Learn from it by not repeating your error / naivety / whatever and any cases which can be easily deduced from the reaction to it. 

20200318, 14:27  #42  
Nov 2003
2^{3}×3^{2}×103 Posts 
Quote:
A mature person who did not understand it, yet still desiring to do this work would take the time to go learn the math. Yes, it takes a lot of time. One can't correctly implement a mathematical algorithm without understanding the math. The first question you should have asked was "What do I need to learn in order to correctly implement this algorithm". Quote:
statements were. If you can't stand to have your discussion criticized then you need to find another venue. 

20200318, 14:29  #43 
Mar 2007
Estonia
2^{2}·3·11 Posts 
R.D. Silverman  I think you mixed me up with the OP. I am not trying to implement anything, I already did: https://github.com/dkull/rpt
Most of the stuff you commented on was left out/ignored for brevity. It bears no significant weight on the magnitude of the final calculation. I think starting with a disclaimer and ending with a question about correctness leaves little room for arrogance. 
20200318, 14:31  #44  
Nov 2017
Karlsruhe, Germany
37_{8} Posts 
Quote:
It's like saying I want to race with a tractor (to pick up on a previous analogy). Then being critizised that that is a bad choice (which is correct). I proceeded to explain that I enjoy racing with tractors and that I don't want to anything but race tractors. Which then resulted people continuing to critize my choice of vehicle, even though it was clear that I was fully aware of the downsides and was chosing for very different reasons. That's just being rude and inappropriate. 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Modifying the Lucas Lehmer Primality Test into a fast test of nothing  Trilo  Miscellaneous Math  25  20180311 23:20 
A second proof for the LucasLehmer Test  carpetpool  Miscellaneous Math  2  20170730 09:21 
LucasLehmer test  Mathsgirl  Information & Answers  23  20141210 16:25 
LucasLehmer Test  storm5510  Math  22  20090924 22:32 
Lucas Lehmer test question?  BMgf  Programming  23  20031209 08:52 