HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's & 0's

01252020, 05:58 PM
(This post was last modified: 01252020 07:28 PM by John Keith.)
Post: #7




RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &...
Hi Gerald,
Thanks for posting this intriguing challenge. Here is my attempt which returns a list of A004290(n) from 0 to n. It will only work on numbers up to 98 because A(99) has more than 12 digits. I opted to use approximate numbers because MOD is slow for exact integers and R>B is limited to 12 digits anyway. The program is still not very fast, taking almost 10 minutes for an input of 98. It could be extended to larger input values with exact integers and some ListExt commands but it would be slower still. Update: I tried an exact integer version for A(99) and it ran for over 10 minutes on EMU48 without completing. I don't think that my program is incorrect since it worked on smaller numbers. I then ran Chai Wah Wu's Python program from the OEIS page and it returned A(99) in less than one second. I then tried A(9990) on the Python program and it took over 15 minutes to complete. I therefor conclude that numbers above 98 are impractical on the HP49/50 without a faster algorithm. Code:


« Next Oldest  Next Newest »

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