# 새 알고리즘이 π의 16진수 추출 속도를 60% 이상 끌어올렸다

Original title: A faster algorithm for extracting hexadecimal digits of π

> Hacker News story 50638075 · language: ko · submitted 2026-11-25
> Web version: https://zeli.app/ko/story/50638075
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 74 · by [vinhnx](<https://news.ycombinator.com/user?id=vinhnx>) · 💬 5
[original](<https://www.stylewarning.com/posts/faster-digit-extraction/>) · [HN discussion](<https://news.ycombinator.com/item?id=50638075>)

## Summary

Robert Smith가 π의 16진수 자릿수를 앞자리 계산 없이 추출하는 새 알고리즘을 공개했다. 기존 BBP, Bellard, Huvent 공식을 능가하며, 특히 Huvent의 8항 공식 대비 큰 오프셋에서 나눗셈은 약 61%, 모듈러 지수승은 38% 줄어든다. 핵심은 분모를 정렬해 네 개의 2의 거듭제곱을 공유하고, 서로 다른 분모 M과 3M에 같은 두 번의 지수승을 재사용하는 데 있다. AVX-512 IFMA 구현으로 1조 자리에서 62% 더 빠른 성능을 보였다.

## Key quote

> 백만 개의 16진수 자리를 건너뛸 때마다 Huvent와 비교해 약 백만 번의 완전한 모듈러 지수승을 절약할 수 있다. 이는 기계별 최적화를 적용하기 전의 수치다.

## HN discussion (5 comments)

### [prajaybasu](<https://news.ycombinator.com/item?id=50648840>)

> 저는 Claude, Gemini, Astra와 함께 작업하면서 π의 16진수 자릿수를 추출하는 더 빠른 알고리즘을 발견했다고 생각합니다.
>
> https://github.com/prajaybasu/math

### [nickcw](<https://news.ycombinator.com/item?id=50640564>)

> 박스로 강조된 주요 공식은 π에 대한 다음 Machin 스타일 공식과 동등합니다
>
> pi = 4 arctan 4/7 + 4 arctan 1/8 + 2 arctan 8/31 + 2 arctan 1/32
>
> arctan 안의 각 분모가 2의 거듭제곱이거나 2의 거듭제곱과 1만큼 차이가 나기 때문에, 이로부터 BBP 공식을 만들어 이전 자릿수를 계산하지 않고도 π의 임의의 16진수 자릿수를 계산할 수 있습니다.
>
> 이것이 어떻게 작동하는지에 대해 비교적 이해하기 쉬운 설명을 https://scholarlycommons.pacific.edu/euleriana/vol3/iss1/3/ 에 써 두었습니다 (이 글에서도 참조하고 있네요!).
>
> 박스로 강조된 공식이 흥미로운 이유는 단일 공통 분모를 갖도록 재배열되어 있어 항당 나눗셈이 한 번만 필요하다는 점입니다.
>
> 느린 것은 바로 나눗셈이기 때문에 그 횟수를 줄이면 계산 속도가 빨라집니다. 그것에 또 다른 트릭을 더해 계산이 가장 잘 알려진 BBP 공식보다 40% 더 빠르게 실행됩니다.
>
> \> Bellard의 간결한 유도 과정의 마지막 단계에는 선택지가 숨어 있다.
>
> 그 말에 웃음이 났습니다. Bellard의 간결한 유도를 이해하는 데 며칠이 걸렸거든요 :-)

### [dh2022](<https://news.ycombinator.com/item?id=50644696>)

> 개선율(%)을 계산하는 공식이 틀렸습니다.
>
> 올바른 공식은 100% - t_after / t_before 입니다.
>
> 글에 있는 공식은 t_before / t_after - 100% 인 것 같습니다. 이는 잘못된 것입니다.
>
> 예를 들어 t_after가 매우 작다면(즉, 개선이 많아 매우 효율적인 계산이라면) 이 공식은 100%를 넘는 개선을 나타내게 됩니다(그리고 이는 명백히 잘못된 것입니다)

---

## Cite

- Page: https://zeli.app/ko/story/50638075
- Date: 2026-11-25
- Source: stylewarning.com (https://www.stylewarning.com/posts/faster-digit-extraction/)
- Hacker News: https://news.ycombinator.com/item?id=50638075

## Other languages

- en: https://zeli.app/story/50638075 · markdown: https://zeli.app/story/50638075.md
- zh: https://zeli.app/zh/story/50638075 · markdown: https://zeli.app/zh/story/50638075.md
- ja: https://zeli.app/ja/story/50638075 · markdown: https://zeli.app/ja/story/50638075.md
- de: https://zeli.app/de/story/50638075 · markdown: https://zeli.app/de/story/50638075.md
- es: https://zeli.app/es/story/50638075 · markdown: https://zeli.app/es/story/50638075.md
- ru: https://zeli.app/ru/story/50638075 · markdown: https://zeli.app/ru/story/50638075.md
