Hi, I ran into this in my Modern Algebra class; and decided it might be of interest. We were given the problem to: "Find the least prime p s.t. 2^(p-1) congruent to 1 (mod p^2)" EVERY prime p > 2 has the property, 2^(p-1) congruent to 1 (mod p), by Fermat's Theorem (since 2 does not divide such prime p). But, mod p^2 is another story. This was given in a class where everything is done by hand calculation, based on theorems. I couldn't come up with any way to determine it other than brute force. Here is a tiny Maple snippet which finds it:
p := 2:
do;
  p := nextprime(p);
  if 2 &^ (p-1) mod p^2 = 1 then
    print(p);
    break;
  end if;
end: 
Turns out to be 1093. Then, it turns out ... this is a famous problem, not just some random homework problem. Primes with this property are called "Wiefrich primes"; and there are theorems based just on these primes (only 2 such primes are known : 1093 and 3511). Questions are raised if there are only finitely many of these, etc. See: http://en.wikipedia.org/wiki/Wieferich_prime

Please Wait...