The Mudcat Café TM
Thread #76199   Message #1349772
Posted By: DMcG
07-Dec-04 - 07:36 AM
Thread Name: BS: Puzzles. can you help me?
Subject: RE: BS: Puzzles. can you help me?
2519 is the smallest positive number, but if you want to be cunning and define things in the right way, -1 will also work.

When the Ada language was being devised, one thing that was investigated was how people thought modular arithmetic should work on integers.   Which of the following should be true?

i) A = (A mod B)*B + (A rem B)

ii) (A rem B) is between 0 and B (excluding B)

iii) (-A) mod B = -(A mod B)


Once you have decided, make up a little table with columns A, B, A mod B and A rem B and try these

A      B
7      3
7      -3
-7    3
-7    -3

and then check out your rules!