Post Reply 
Programming puzzle: Longest list of regular numbers?
04-17-2017, 12:28 PM (This post was last modified: 04-17-2017 01:57 PM by e_emil.)
Post: #11
RE: Programming puzzle: Longest list of regular numbers?
(04-17-2017 11:24 AM)pier4r Wrote:  7000 numbers do exhaust the 64 mb of the Nspire?

The innermost loop appends every new number at the end of the existing list which may not be an efficient way of managing memory on the nSpire? I'll try with a pre-allocated list of sufficient length and see if there's any difference. Anyway, speed difference compared with the 50g is remarkable.

I read the wikipedia page on Hamming numbers and it appears that they use a very similar geometric approach to estimate the number of regular numbers not greater than N: the inequality (ln 2)x + (ln 3)y + (ln 5)z <= ln N is satisfied by all regular numbers that are less or equal than N (assumming that a number of the form 2^x3^y5^z corresponds to the point (x,y,z)), which is the same idea that I used in the algorithm Wink

EDIT: Challenge 3 solved!

the 9733rd number is 198135565516800000 (exactly - zeros at the end are _not_ due to rounding). Can be also written as 2^30*3^10*5^5.

9732: 197912092999680000
9733: 198135565516800000
9734: 200385994162176000

Time: 4 minutes 20 seconds on the nSpire CX CAS, using a modification of my previous program (calculating but not storing intermediate results). Had to switch to the "exact" mode, because the numbers already have 17 digits. The greatest power of two smaller than H(9733) is 2^57, so "smax" has to be 57 or more.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzle: Longest list of regular numbers? - e_emil - 04-17-2017 12:28 PM



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