Hey guys,(adsbygoogle = window.adsbygoogle || []).push({});

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 ([itex]k \in \mathbb{N}[/itex]).

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 [itex]\equiv[/itex] 1 (mod 3). 20/4 [itex]\equiv[/itex] 0 (mod 5). 20/6 non-integer. 20/8 non-integer. 20/10 [itex]\equiv[/itex] 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.

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Automating Reduction by a Varying Modulus

Loading...

Similar Threads - Automating Reduction Varying | Date |
---|---|

ImageJ Automated Tracker | Dec 29, 2016 |

Insights Administering TCP/IP In Automation or Measurement Networks - Comments | Feb 24, 2016 |

Industrial automation programming | Nov 20, 2015 |

Reduction problem | Oct 17, 2015 |

Automating Email Opening | Jul 16, 2012 |

**Physics Forums - The Fusion of Science and Community**