在线求 π 任意位的小工具,可以查到你的生日在 π 的多少位
网页: https://roy2100.github.io/pi-calculator纯本地计算,用的 GMP 的 wasm 版本
如果你在网站上计算 PI 的 10000 位,理论上可以找到你的 4 位数生日
如果你在网站上计算 PI 的 1,000,000 位,理论上可以找到你的 6 位数生日
有兴趣的可以试试,还可以测试你的 CPU 单核性能
https://i.imgur.com/O9fTtni.jpeg 直接找那个 txt 文件不是更简单 即刻上曾经火过的一个小游戏 根本不需要计算,做个 365 的映射就行了。 然而哈基米告诉我不需要计算。
import mmap
def search_large_pi(search_target, file_path):
target_bytes = str(search_target).encode('utf-8')
with open(file_path, "r+b") as f:
# 创建内存映射
with mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as mm:
position = mm.find(target_bytes)
if position != -1:
print(f"找到位置:小数点后第 {position + 1} 位")
else:
print("未在此大文件中找到该数字")
页:
[1]