testing value of last digit of an integer.

David McKen cic_3_b at yahoo.com
Sun Apr 4 07:23:08 CEST 2004


I want to check if the last digit of an integer is 5.

I am contemplating using the mpz_tstbit function to test for the
binary
representation of 5 which is 0 1 0 1. The leading zero is to prevent
13 from
accidentally being detected. Any further out and the binary digits
would not
affect the last digit.

Does anyone know any other way I can do this?

The numbers are quite large (about 300 digits) and it is already
known that
the numbers are odd.


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/


More information about the gmp-discuss mailing list