Talk:Hamming numbers: Difference between revisions

→‎Off-by-one error?: Let's stop worrying about it and instead beat up on obviously sub-standard implementations.
(→‎Off-by-one error?: Let's stop worrying about it and instead beat up on obviously sub-standard implementations.)
Line 14:
:::</pre>My only concern is whether I had an off-by-one error from counting indices from zero or one (i.e., is it ''H''<sub>0</sub> or ''H''<sub>1</sub> that is 1? My impl assumes it is ''H''<sub>1</sub>...) –[[User:Dkf|Donal Fellows]] 10:20, 3 December 2009 (UTC)
:::: So I think it is safe to say that we agree on the value of the 1690th Hamming number. Here it doesn't matter wheter indexing is zero-based or one-based. If we agree that the first Hamming number is 1, it is clear what we mean by the 1690th Hamming number. The only difference between zero-based indexing compared to one-based is that the first Hamming number is called hamming(0) in the former case and hamming(1) in the latter. Similarly for the 1690th Hamming number: with zero-based indexing it is called hamming(1689) as compared to hamming(1690) with one-based indexing. Anyway, to me it still looks like the last Hamming number before 2^31 is the 1691th, since the 1692th Hamming number is equal to 2^31. --[[User:Dsnouck|Dsnouck]] 10:48, 3 December 2009 (UTC)
::::: Hence the error is in the task itself. But it's not serious; any implementation that can compute one ought to be able to do the other (and if it can't... well, that's pretty poor). Doing the millionth though, that takes a bit more computation. Especially given that it has 84 digits in decimal notation. –[[User:Dkf|Donal Fellows]] 11:15, 3 December 2009 (UTC)
Anonymous user