Thread: Perfect sqquare
View Single Post
Old 2011-08-24, 12:42   #4
science_man_88's Avatar
"Forget I exist"
Jul 2009

26·131 Posts

Originally Posted by JohnFullspeed View Post
When you search a perfzct square the first step is to test the last digit

I need tto find value with 3 like last didit
Id ity possible to make one or two tests like
(n & 7 == 1) or (n & 31 == 4) or (n & 127 == 16) or (n & 191 == 0) then John
if you want to check the last decimal digit of a number do mod 10 and compare to the endings of squares ( 0,1,4,9,6,5) is how I would do it. also if (x-(x mod 10 ))/10 is a certain type of number you can tell if it's a square even more.
science_man_88 is offline   Reply With Quote