Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
08-29-2017, 09:14 PM (This post was last modified: 08-29-2017 09:40 PM by Gilles59.)
Post: #15
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.

Your RPL is not so bad :

Code:
'IntOdd(n)=10*IFTE(n<=5,0,IntOdd(IP((n-1)/5)))+2*((n-1) MOD 5)+1' 
 DEFINE

Works fine but this recursive approach is slow with the HP50G
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 - Gilles59 - 08-29-2017 09:14 PM



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