TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Pascal Schmidt
date: 2004-03-29 17:02:12
subject: squares

Hi Jasen! :-)

 JB> are there shorcuts to tell if a big integer (bignum) is not a square?
 JB> (like without trying to square-root it.)
Well, for integers, the last digit of any square is produced by squaring
the last digit of the square-root (modulo 10):

digit in root      digit in square
----------------------------------
     0                   0
     1                   1
     2                   4
     3                   9
     4                   6
     5                   5
     6                   6
     7                   9
     8                   4
     9                   1

Thus, no integer ending in 2, 3, 7, or 8 can be the square of any other
integer. This reduces the problem space by 40%. ;)

Ciao
Pascal

--- Msged/LNX 6.1.1
* Origin: Linux FAQ - http://www.tzi.de/~pharao90/faq/ (1:153/401.2)
SEEN-BY: 633/267 270
@PATH: 153/401 307 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.