Post Reply 
HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
08-30-2017, 09:06 AM (This post was last modified: 08-30-2017 09:06 AM by pier4r.)
Post: #18
RE: HP 49G Programming Challenge: OEIS A014261, Integers with exclusively Odd Digits
So I have in mind two approaches (way poorer than the approaches already posted)

- one that is simulating exactly how the sequence is create through keeping which number is in which position.
For example
given the list { 1 3 5 7 9 }
37 -> { 2 4 } -> (1st digit from the left, pick the second element, 2nd digit from the left, pick the 4th element)
Then I increment the list and I get { 2 5 } that is equal to 39. Then the next increment would lead to { 3 1 } and so on.

this of course would be pretty slow but it should work. (and as you can see, it is like list processing)

- the other idea is to get the Nth number, convert it in base 5. And then substitute the digits (having the number seen as string) with a mapping. So for example:
13th number, in base 5 it is 23, substitute 2 with 3 (2nd element in the list) and 3 with 5 (5th element in the list). So I get 35. (as you can see, it is like string processing)

This may be slow but it is more interesting for me. I am trying to get it work but still I have problems with placing the 9 instances, because every time I have a carry with that.

Lesson learned from this challenge: while others may find very nice math relationships or algorithms, trying to follow an idea that is neither small nor fast but interesting may be enough for personal experience. An idea that exists because the challenge was posed, so great input! Thanks Gerald.

(this also slows down other projects where I am committed, damn me and my "let's do it!" approach)

Wikis are great, Contribute :)
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 - pier4r - 08-30-2017 09:06 AM



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