十亿分之一的丑数还是汉明数? [英] 1 billionth ugly or hamming number?

查看:48
本文介绍了十亿分之一的丑数还是汉明数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是第 10 亿个丑数/汉明数吗?

Is this the 1 billionth ugly/hamming number?

6256509672447190388842453797301489049168696812692125007654121286208093442514438976692222667734743108165348546009548371249535465997230641841310549077830079108427085204979890783430410814298892460634727751810693035966250389852142922367844305836604673449401567443535878185727935514895065062938282245169620342687131222168584877816068576714140173718

62565096724471903888424537973014890491686968126921250076541212862080934425144389 76692222667734743108165348546009548371249535465997230641841310549077830079108427 08520497989078343041081429889246063472775181069303596625038985214292236784430583 66046734494015674435358781857279355148950650629382822451696203426871312216858487 7816068576714140173718

有没有人可以分享可以验证这一点的代码?谢谢!

Does anyone have code to share that can verify this? Thanks!

推荐答案

这个 SO 答案 显示了一个能够计算它的代码.

This SO answer shows a code capable of calculating it.

ideone.com 上的 测试条目需要 1.1 0.05109 (2016-08-18:由于使用 Int 而不是默认的Integer 在可能的情况下,即使在 32 位上;由于@GordonBGood 建议的调整,额外增加了 20%,将带大小的复杂性降低到 O(n1/3)).

The test entry on ideone.com takes 1.1 0.05 sec for 109 (2016-08-18: main speedup due to usage of Int instead of the default Integer where possible, even on 32-bit; additional 20% thanks to the tweak suggested by @GordonBGood, bringing band size complexity down to O(n1/3)).

它给出的答案为 ((1334,335,404),"6.21607575556559E+843"),即

It gives the answer as ((1334,335,404),"6.21607575556559E+843"), i.e.

  21334 * 3335 * 5404 ≈ 6.21607575556559 * 10843.

    21334 * 3335 * 5404 ≈ 6.21607575556559 * 10843.

(巧合的是,上面的小数中只有最后两位数字不正确).

当然,这也意味着这个数字的末尾有 404 个零,总共有 844 位数字.所以不,你显示的数字不是.

This also means, of course, that there are 404 zeroes at the end of this number, and that it has 844 digits in total. So no, the number you show isn't it.

这篇关于十亿分之一的丑数还是汉明数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆