Automating Reduction by a Varying Modulus

  • Thread starter Thread starter middleCmusic
  • Start date Start date
  • Tags Tags
    Modulus Reduction
AI Thread Summary
The discussion revolves around automating a specific primality test involving even numbers. The process includes dividing an even number N by 2k, where k is a natural number, and checking if the result is an integer. If it is, the next step is to reduce this integer modulo 2k+1. The goal is to identify and print those values of k (or 2k) for which the result is odd. An example with N = 20 illustrates the procedure, highlighting that only 2k = 2 yields an odd reduction. Participants clarify misunderstandings about the calculations and mention alternative primality testing methods, such as the Sieve of Eratosthenes, but the original poster emphasizes that they are looking for a specific automation solution rather than alternative algorithms. They express a desire for assistance in implementing this logic using Mathematica or Maple, despite their limited programming skills.
middleCmusic
Messages
74
Reaction score
0
Hey guys,

I'm doing some experimenting recently with some primality tests, and I need help figuring out how to automate the following:

Given an even number N, divide by 2k (k \in \mathbb{N}).
If N/2k is an integer, reduce mod 2k+1.
(If N/2k is not an integer, simply move on to the next one.)
Do this for all 2k ≤ N/2.
Then print those k (or 2k, doesn't really matter to me) for which the resulting reduction by the modulus 2k+1 is odd.

EX: N = 20. 20/2 \equiv 1 (mod 3). 20/4 \equiv 0 (mod 5). 20/6 non-integer. 20/8 non-integer. 20/10 \equiv 10 (mod 11).
Print: 2k = 2 (or k = 1), since this is the only odd reduction that was obtained.

If it helps, I have Mathematica and Maple, as well as some basic understanding of LaTeX, but my programming skills are pretty crappy. Thanks in advance!

P. S. I wasn't sure if I should post this in the Computer Science forum, but I figured that it's more of a math topic anyway, and there are bound to be some math people who know how to do this.
 
Technology news on Phys.org
middleCmusic said:
Hey guys,

I'm doing some experimenting recently with some primality tests, and I need help figuring out how to automate the following:

Given an even number N, divide by 2k (k \in \mathbb{N}).
If N/2k is an integer, reduce mod 2k+1.
(If N/2k is not an integer, simply move on to the next one.)
Do this for all 2k ≤ N/2.
Then print those k (or 2k, doesn't really matter to me) for which the resulting reduction by the modulus 2k+1 is odd.

EX: N = 20. 20/2 \equiv 1 (mod 3). 20/4 \equiv 0 (mod 5). 20/6 non-integer. 20/8 non-integer. 20/10 \equiv 10 (mod 11).
I'm not following your logic here. In any case, 20/10 = 2 ##\equiv## 2 (mod 11). There's another way of checking for primes - the Sieve of Eratosthenes.
middleCmusic said:
Print: 2k = 2 (or k = 1), since this is the only odd reduction that was obtained.

If it helps, I have Mathematica and Maple, as well as some basic understanding of LaTeX, but my programming skills are pretty crappy. Thanks in advance!

P. S. I wasn't sure if I should post this in the Computer Science forum, but I figured that it's more of a math topic anyway, and there are bound to be some math people who know how to do this.
 
Oops my bad. That should have been a 2, yeah. The Sieve of Eratosthenes is not what I'm looking for though. I'm not expecting anyone to see my logic in doing this, just wondering if anyone knows how.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top