# HP Forums

Full Version: Generate the largest Prime Number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to create program on HP RPN programmable calculator to generate the largest possible digits of prime number? Just like generating the Decimal digits of Pi or e
If possible just wondering what is the largest Prime number that scientific calculator can generate.

Gamo
(02-06-2018 03:05 AM)Gamo Wrote: [ -> ]Is there a way to create program on HP RPN programmable calculator to generate the largest possible digits of prime number? Just like generating the Decimal digits of Pi or e

The largest possible digits ?
In a decimal number the largest possible digit is 9. But I assume you knew that already. ;-)

(02-06-2018 03:05 AM)Gamo Wrote: [ -> ]If possible just wondering what is the largest Prime number that scientific calculator can generate.

It depends. On a standard 10-digit calculator the last digit of all numbers ≥ 1010 implicitely is zero, so these cannot be prime. The largest prime below this threshold is 9999999967. But on a regular RPN calculator it will take some time to confirm this.

Dieter
For generating the digits of prime by mean of adding set of digits for next prime.
For example:

If this is the maximum digits that can show on screen x,xxx,xxx,xxx write this down and program can generate the next prime for the next set of digits.

x,xxx,xxx,xxx
x,xxx,xxx,xxx,yyy,yyy......

The program on computer I'm not sure how that work when they try to generate the largest prime.

Gamo
The highest prime number that fill 10 digits calculator screen is 9,999,999,997
The next prime is 10,000,000,019 which is 11 digits that can't fill in the screen.

so is this possible to produce prime by first show first 10 digits and when press R/S that will go on to the next result of prime digit.

1000000001 R/S result 9 > 10,000,000,019
1000000003 R/S result 3 > 10,000,000,033
1000000006 R/S result 1 > 10,000,000,061
.
.
.
1000000009 R/S result 7 > 10,000,000,097
1000000001 R/S result 03 > 10,000,000,103
.
.

Gamo
(02-07-2018 09:26 AM)Gamo Wrote: [ -> ]The highest prime number that fill 10 digits calculator screen is 9,999,999,997
The next prime is 10,000,000,019 which is 11 digits that can't fill in the screen.

1000000001 R/S result 9 > 10,000,000,019
(...)
1000000001 R/S result 03 > 10,000,000,103

I assume the last line is supposed to read

1000000010 R/S result 3 > 10,000,000,103

Now, what do you want to get if you enter a 10-digit number like 1.000.000.001?

- The next prime with 11 digits?
That's 10.000.000.019, so the output is 9 ?
This means: determine the next prime after 10*x.

- The next prime with 12 digits?
That's 100.000.000.103, so the output is 03 ?
This means: determine the next prime after 100*x.

- The next prime with 13 digits?
That's 1.000.000.001.051, so the output is 051 ?
This means: determine the next prime after 1000*x.

Let's assume you mean the first case. "Determine the next prime" here simply means:
Check if the following numbers are prime:
10*x+1, 10*x+3, 10*x+7 and 10*x+9

So it boils down to an algorithm like this:

Code:
```input x found=false p = 10*x+1 checkprime(p) p = 10*x+3 checkprime(p) p = 10*x+7 checkprime(p) p = 10*x+9 checkprime(p) if not found then print "No primes between " 10*x " and " 10*x+9 end subroutine checkprime(p): if isprime(p) then    print p   found=true end```

Now, how do you check if an 11-digit number is divisible by, say, 7 while all you got is a 10-digit calculator? I'd say this can be done. Think hard. ;-)

Dieter
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :