Post Reply 
Generate the largest Prime Number
02-06-2018, 03:05 AM
Post: #1
Generate the largest Prime Number
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
Find all posts by this user
Quote this message in a reply
02-06-2018, 04:13 AM (This post was last modified: 02-06-2018 04:14 AM by Mike (Stgt).)
Post: #2
RE: Generate the largest Prime Number
(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?

Yes, there is a way to create program on HP RPN programmable calculator to generate the largest possible digits of prime number. You ask for digits of a prime number, not the number itself. With the base 10 all possible digits are 0..9 (for example in prime 123456789059) where 9 and 8 are the largest ones.

If it's about prime numbers try primesieve. While waiting for a result consider what's your goal by using an HP RPN programmable calculator for prime numbers. Or digits thereof.

Ciao.....Mike
Find all posts by this user
Quote this message in a reply
02-06-2018, 08:04 PM
Post: #3
RE: Generate the largest Prime Number
(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
Find all posts by this user
Quote this message in a reply
02-07-2018, 12:34 AM (This post was last modified: 02-07-2018 12:34 AM by Gamo.)
Post: #4
RE: Generate the largest Prime Number
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
Find all posts by this user
Quote this message in a reply
02-07-2018, 03:39 AM
Post: #5
RE: Generate the largest Prime Number
(02-07-2018 12:34 AM)Gamo Wrote:  For generating the digits of prime by mean of adding set of digits for next prime.
[...]
x,xxx,xxx,xxx
x,xxx,xxx,xxx,yyy,yyy......

Never heard of such a procedure. What is with all the primes between x,xxx,xxx,xxx and x,xxx,xxx,xxx,yyy,yyy? For example, first prime is 2, juxtapose digit 3 to get 23 and then another 3 to get 233, is that what you want? Please explain more details.

There may exist some prime 'breeding' procedures I don't know. Widely known are the sieve algorithms, Eratosthenes, Sundaram, and Atkin. Basicly they fill a field with candidates and kick out step by step what is not and 'harvest' the remaining primes. An example in 'pseudocode' (pst ... it is REXX):
Code:
/* SOE EXEC: Sieve of Eratosthenes                                    */
   p. = 1                             /* "fill" the index field       */
   z = 999                            /* limit search                 */
   say 2                              /* display first prime          */
   do n = 3 to z by 2                 /* test only odd numbers        */
      if p.n then do                  /* if prime, then...            */
         say n                        /* display it                   */
         do i = n * n to z by 2 * n   /* go over the index field      */
            p.i = 0                   /* and remove products of it    */
         end i
      end
   end n
The field are only flags, 1 = is prime, 0 = is not, the index is the number in question.
By testing only odd numbers there is no need to kick out even numbers. This could be extended to products of 2 and 3, or 2 and 3 and 5, see wheel factorization.

If you know something faster, I mean much faster, please let me know.

Ciao.....Mike
Find all posts by this user
Quote this message in a reply
02-07-2018, 09:26 AM
Post: #6
RE: Generate the largest Prime Number
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
Find all posts by this user
Quote this message in a reply
02-07-2018, 11:37 AM
Post: #7
RE: Generate the largest Prime Number
(02-07-2018 09:26 AM)Gamo Wrote:  [...]
1000000001 R/S result 9 > 10,000,000,019
[...]
1000000001 R/S result 03 > 10,000,000,103
[...]

First you could develop a technique how your calculator could discern what result you want for the same input.
/M.
Find all posts by this user
Quote this message in a reply
02-07-2018, 07:33 PM (This post was last modified: 02-07-2018 07:35 PM by Dieter.)
Post: #8
RE: Generate the largest Prime Number
(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
Find all posts by this user
Quote this message in a reply
Post Reply 




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