<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 20, 2017 at 10:24 PM, <span dir="ltr"><<a href="mailto:jep200404@columbus.rr.com" target="_blank">jep200404@columbus.rr.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
##############################<wbr>##############################<wbr>###################<br>
<br>
making hamming numbers<br>
<br>
wp:Smooth number<br>
wp:Hamming numbers<br>
wp:Richard Hamming<br></blockquote><div><br></div><div>One to add is:</div><div><br></div><div>wp:Regular number</div><div><br></div><div>That deals with 5-smooth numbers specifically. I think the term was coined by someone studying Babylonian (base 60) mathematics, which only allows division by such "regular" numbers. They also come up in music theory (intervals between notes in the 'just' tuning scheme).</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Second version tries to avoid duplication,<br>
so is much faster and uses much much less memory.<br>
Seems to be fast enough for the 1000000th hamming number.<br>
It even seems to be correct.<br>...<br>
doj@sbc:~/20171026$ time ./ham2.py 1000000<br>
1000000 519312780448388736089589843750<wbr>000000000000000000000000000000<wbr>000000000000000000000000<br>
<br>
real 8m31.437s<br>
user 8m27.944s<br>
sys 0m2.252s<br></blockquote><div><br></div><div>Not sure of the state of the art, but check out this old Dr. Dobbs article (2008):</div><div><br></div><div><a href="http://www.drdobbs.com/architecture-and-design/hamming-problem/228700538">http://www.drdobbs.com/architecture-and-design/hamming-problem/228700538</a></div><div><br></div><div>They report a Lisp version that took 900 seconds to generate 127 million Hamming numbers.</div><div><br></div><div>A lot people skip trying to calculate the entire sequence up to the nth Hamming number, instead just finding the nth number alone, using an algorithm described in the Dr, Dobbs article .</div><div><br></div><div>This page:</div><div><br></div><div><a href="https://rosettacode.org/wiki/Hamming_numbers">https://rosettacode.org/wiki/Hamming_numbers</a><br></div><div><br></div><div>...has a lot of implementations in different languages, but most are of the "just give the nth number" variety.</div><div><br></div><div>Joe</div></div><br></div></div>