Post Reply 
Find number property and write RPL program (HP-49G,G+, HP 50g)
09-24-2014, 08:33 PM
Post: #18
RE: Find number property and write RPL program (HP-49G,G+, HP 50g)
(09-24-2014 08:01 PM)Thomas Ritschel Wrote:  
(09-24-2014 05:54 PM)Gerson W. Barbosa Wrote:  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.

How about the following:
Code:
%%HP: T(3)A(R)F(.);
 \<< 2 * -1 -
 \>>

Subtracting "-1" might seem a bit counterintuitive. But using the more obvious "1 +" would instead append "1" to the list.

Bingo! Smile
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 08:33 PM



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