From: Alejandro Dubrovsky (s328940@student.uq.edu.au)
Date: Thu May 02 2002 - 02:42:33 MDT
On Thu, 2002-05-02 at 17:28, Lee Corbin wrote:
>
> By the way, since you're up late running strange
> programs, here's one that might interest you that
> I recently wrote:
>
> // This program tries to figure out how many
> // solutions exist for each positive N to the
> // equation x^2 == 1 (mod N). (When N is prime,
> // solutions depend on "The Law of Quadratic
> // Residues".)
>
> // But I may have made an interesting discovery
> // for composite N. Something very strange happens
> // when N is greater than 46334. Run the following
> // program, and you'll see!
something called "integer overflow" :) 46500 squared > 2^31 which is
the positive limit for a signed int (on x86). change it to unsigned int
and the mysterious effect mysteriously dissapears.
Alejandro
This archive was generated by hypermail 2.1.5 : Sat Nov 02 2002 - 09:13:46 MST