Post Reply 
(12C) Check if given number is Prime Number or not
09-11-2018, 07:18 AM (This post was last modified: 09-11-2018 07:38 AM by Dieter.)
Post: #8
RE: (12C) Check if given number is Prime Number or not
(09-11-2018 05:42 AM)Gamo Wrote:  The prime number is 9,000,000,001

Result on:

Real 12C answer 0 [X<>Y] 2

Emulator 12C answer 0 [X<>Y] 2

Emulator 12C Platinum 1 X<>Y 9,000,000,001

Is this another rounding problem on the 12C ?

As Thomas already pointed out, the problem is the 12C's 10-digit precision. Here divided by 2 simply is 4.500.000.001 – an integer, so the program thinks that the input is divisible by 2 and thus not a prime. The same would also happen when dividing by 3, 5, 7 or 9 and even 25.

As already discussed in the other thread with the program that checks whether one integer is a power of another, the 12CP does not seem to round its results to 10 significant digits. Which means that here a fractional part exists and thus the test performs correctly.

But this seems to be a bug in the 12CP emulator. I don't know much about the physical 12CP. How does it work? Does it have the same 10-digit precision as the 12C? Or does it use a higher precision while only 10 (out of 12 or 15) digits are displayed?

You may try this: calculate 4.444.444.444 / 3 and get 1.481.481.481. Now subtract 1.481.481.481 (or press g FRAC). On a real 12C the result is 0. But what do you get on the 12CP emulator? 0,3? 0,333? Please post all digits (i.e. as displayed in FIX 9).

Having said that, the largest input for a number to test is 1.999.999.999.
So the largest prime is 1.999.999.973. How long does this take on your various devices?

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: (12C) Check if given number is Prime Number or not - Dieter - 09-11-2018 07:18 AM

User(s) browsing this thread: 1 Guest(s)