The Converse of Little Theorem

It is known that if N N is prime, then a N a a^N - a is a multiple of N N for any integer a . a.

However, there also exist composite numbers N N that satisfy this property.

What is the smallest of such N ? N?


The answer is 561.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Julien Marcuse
Jun 6, 2018

Java solution: import java.math.BigInteger; import java.util.ArrayList; public class Main {

     public static void main(String []args) {
        ArrayList<Integer> primes = new ArrayList<>();
        primes.add(2);
        primeloop:
        for (int i = 3; i < 1000; i++) {
            for (int prime : primes) {
                if (i % prime == 0) {
                    continue primeloop;
                }
            }
            primes.add(i);
        }
        loop:
        for (int n = 1; n < 1000; n++) {
            if (primes.contains(n)) {
                continue loop;
            }
            for (int a = 1; a < 100; a++) {
                BigInteger num = new BigInteger(a + "");
                BigInteger other = num.pow(n);
                other = other.subtract(new BigInteger(a + ""));
                if (other.mod(new BigInteger(n + "")).intValue() != 0) {
                    continue loop;
                }
            }
            System.out.println(n);
        }
     }
}

Explanation: This finds all primes between 1 and 1000 and adds them to a list, then goes through and tests each that is not a prime to see if all it satisfies the rule for all integer values of a from 1-100. I had to use BigInteger because a normal int or long can't handle the insanely large values that you get when doing operations which go as high as 1000^100.

Of course! BigIntegers!

Robert Tobio - 3 years ago
Patrick Corn
Jun 1, 2018

The answer is 561 \fbox{561} . This is the subject of the wiki on Carmichael numbers , which is currently inactive (someone should fill it in!). The result is mentioned in the wiki on Carmichael's lambda function .

How can we find this number 561?

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...