Article View: bit.listserv.graph-ti
Article #1936Re: mod trouble
From: Mark Janeba
Date: Wed, 19 Jan 1994 00:51
Date: Wed, 19 Jan 1994 00:51
30 lines
2357 bytes
2357 bytes
On Tue, 18 Jan 1994, george tintera wrote: [...] > afternoon and started getting wrong moduli. specifically... > mod(2**47,47) returns the value 4 rather than the correct value of 2. > (yes, on my calculator i used a 'caret' rather than **). > George, the problem here is not with "mod" per se. 2^47 is about 1.4E14, and is larger than the TI-85 can calculate exactly (The TI-85 carries 14 digits internally, but displays fewer). Thus, 2^47, having 15 digits, is stored in the machine without the crucial "ones place". Who knows WHAT the mod does with numbers whose digits are not known down to the decimal point. More relevant, I've got a bunch of number theory programs for the TI-85 that will do what you want, including modular powers of numbers up to 2E13, for powers up to about the same, provided the modulus is <= about 2E13. The trick is to take the modular residue after each multiplication. This is much faster than it sounds, though, since you square your base repeatedly and use the results to quickly build the desired power. Anyway, give me a day or two and I'll send you some programs. Please let me know by private mail if you've got a TI-link or if you need ASCII code. Regards, Mark Janeba (503)370-6123 Dept. of Mathematics e-mail: mjaneba@willamette.edu Willamette University "Speaking for myself, not the university" Salem, Oregon 97301-3922 USA
Technical Details
Message-ID:
<Pine.3.05.9401181637.A11670-b100000@jupiter>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!paladin.american.edu!auvm!jupiter.willamette.edu!mjanebaShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 104512,ef3775646e90e2f3 X-Google-Attributes: gid104512,public X-Google-ArrivalTime: 1994-01-19 01:40:28 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!paladin.american.edu!auvm!jupiter.willamette.edu!mjaneba Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU Newsgroups: bit.listserv.graph-ti Return-Path: <@AUVM.AMERICAN.EDU:graph-ti@LISTS.ACS.OHIO-STATE.EDU> Date: Tue, 18 Jan 1994 19:51:19 -0500 Message-ID: <Pine.3.05.9401181637.A11670-b100000@jupiter> Errors-To: gregt@math.ohio-state.edu Reply-To: graph-ti@lists.acs.ohio-state.edu Originator: graph-ti@lists.acs.ohio-state.edu Sender: graph-ti@lists.acs.ohio-state.edu Precedence: bulk From: Mark Janeba <mjaneba@jupiter.willamette.edu> Subject: Re: mod trouble X-Listprocessor-Version: 6.0a -- ListProcessor by Anastasios Kotsikonas X-Comment: Texas Instruments Graphing Calculators Lines: 33