How to generate all of the numbers of pi in Objective-C [closed]

牧云@^-^@ 提交于 2019-12-04 07:16:48

问题


I want to create an iPad application named "Am I in Pi?" to check birthday numbers with Pi numbers and show the numbers. My question is how can I generate all of the million numbers of pi 3.1415.... etc. Is there any library in Objective-C or XML file or function that I can use for my implementation?


回答1:


Rather than generating pi and searching for a certain sequence of digits, you're best off simply saying yes all the time. There is no evidence for any sequence not being in pi.




回答2:


Grab the 1 megabyte of text for pi.

Writing a script, all 1, 2, 3, and 4 digit sequences exist within this file. Only the following 5 digit sequences don't exist within the first 1M digits of pi:

!!! 14523 not found
!!! 17125 not found
!!! 22801 not found
!!! 33394 not found
!!! 36173 not found
!!! 39648 not found
!!! 40527 not found
!!! 96710 not found

Rather than scanning the text file each time, index the location of all '#', '##', '###', '####' strings.

If you want all 5 or longer digits to be found in the string, include a larger version of the digits of pi.

Calculating the first N million digits of pi on an ipad is a waste of cpu and battery when the data file isn't that large.



来源:https://stackoverflow.com/questions/13018816/how-to-generate-all-of-the-numbers-of-pi-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!