Post Reply 
Find number property and write RPL program (HP-49G,G+, HP 50g)
09-24-2014, 05:54 PM
Post: #11
RE: Find number property and write RPL program (HP-49G,G+, HP 50g)
(09-24-2014 05:05 PM)Thomas Ritschel Wrote:  
(09-24-2014 04:04 PM)Gerson W. Barbosa Wrote:  Only 22% of the first thousand prime numbers are in the list, and this percentage drops to about 8% for the first million numbers, so I was amazed at finding one 11-digit such prime in a universe of only 12 numbers.
Too many hints by now :-)

That were indeed too many hints!
Your numbers are Sophie-Germain primes, e.g. prime numbers p for which 2p+1 is also prime.

Yes, congratulations!

Researching, or searching, the internet was allowed, hence no hints should be necessary, I thought. But if useful resources like Wolfram Alpha or OEIS are not used, then the solution becomes very difficult, as the property is not evident. Who would think of doubling the numbers and adding 1 to the result and finally checking the result for prime? :-)

I think Wolfram Alpha is the easier way. Just submit any of the numbers to W|A and check the properties. For instance:

http://www.wolframalpha.com/input/?i=22408349

OEIS might also have been used. 2, 3, 5 are the first three elements. The next one is 11. This hasn't been given, but might have been tried:

http://oeis.org/search?q=2%2C3%2C5%2C11%...&go=Search

This returns too many sequences as well. But the one we are looking for is the second.

Sorry if somehow I've spoiled it. Item 2 is interesting anyway. Also, in order to make the RPL exercise a little bit more interesting, lets introduce item 2.1:

Given a list of Sophie Germain primes, write an RPL program that retuns the corresponding safe prime numbers. For instance:

{ 2 3 5 11 } --> { 5 7 11 23 }

This is very very simple, of course, but trying to get a shortest program as possible might make for a good exercise.

Quote:Unfortunately I don't have my 50g with me right now. So I would leave it to someone else to present a RPL solution...

Debug4 is an option (I think it contains the required ROM), unless you cannot install it on the computer you are at now.

Cheers,

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


Messages In This Thread
RE: Find number property and write RPL program (HP-49G,G+, HP 50g) - Gerson W. Barbosa - 09-24-2014 05:54 PM



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