Go Back > Extra Stuff > Programming

Thread Tools
Old 2004-10-15, 06:44   #1

820610 Posts
Exclamation Question relating to Fermat's theorem

Ok so explains briefly how to find primes:

It explains fermat's theorem like this:

Given n > 1, choose a > 1 and calculate (a^n)-1 modulo n. If it is one modulo n, then n might be prime.

I don't understand how I can calculate this on a computer. I know there is c code for performing mod.

But let's say you have a really big number of form (k*(2^n)) +/- 1
what roughly would I put into a c code program to mod that number to tell if it's a 2-prp????
  Reply With Quote
Old 2004-10-17, 11:03   #2

5·13·131 Posts
Default Well???

Does anyone know where I can find the answer to such a question
  Reply With Quote
Old 2004-10-17, 13:26   #3
ET_'s Avatar
Aug 2002
Team Italia

480310 Posts

Originally Posted by Acidity
Does anyone know where I can find the answer to such a question
Try visiting

There is a multi-precision C library that allows mod operations in multiple precision integers.

ET_ is offline   Reply With Quote

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modified Fermat's theorem devarajkandadai Number Theory Discussion Group 2 2017-06-23 04:39
abc conjecture and Fermat's Last Theorem jasong jasong 3 2012-10-24 08:45
Fermat's Last Theorem Essay henryzz Homework Help 2 2011-02-15 07:39
Fermat's Theorem Crook Math 5 2005-05-05 17:18
Fermat,s Theorem devarajkandadai Miscellaneous Math 3 2004-06-05 10:15

All times are UTC. The time now is 01:02.

Mon Mar 8 01:02:41 UTC 2021 up 94 days, 21:14, 1 user, load averages: 2.99, 2.57, 2.38

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, 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.