Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
08-29-2017, 04:29 PM
Post: #11
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
(08-29-2017 04:02 PM)Didier Lachieze Wrote:  My RPL is a bit rusty, so instead here is an HP Prime program:

Code:
EXPORT IntOdd(N)  
BEGIN  
    10*IFTE(N<=5,0,IntOdd(IP((N-1)/5)))+2*((N-1) MOD 5)+1;
END;

IntOdd(50) returns 179 in 0.5ms on my Prime.

Very nice, Didier.

Ihave translated the programme to the 49G thus:

Code:
INTODD

« → N
  « N 5 ≤
    IF
    THEN 0
    ELSE N 1 - 5
IQUOT INTODD
    END 10 * 1 + N
1 - 5 MOD 2 * +
  »
»

which I trust meets with your approval.

Time on 49G for input 50 is 0.81s & all answers have so far been correct.

At the moment you lead the field. Bravo!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits - Gerald H - 08-29-2017 04:29 PM



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