The BBP formula for $\pi$ runs in $O(n \log n)$. I was wondering if there are irrational constants whose $n$-th digit can be computed in time $O(1)$ or at most $O(\log n)$.
Famous irrational constants whose $n$th digit can be computed in constant time?
4
$\begingroup$
computational-complexity
irrational-numbers
decimal-expansion
constants
2 Answers
5
The number $$\sum_{k=1}^\infty\frac1{10^{10^k}}$$ is irrational. With good marketing can become as famous as $\pi$.
-
1Is the k supposed to be an n or vice versa? Or is n a constant? – 2017-01-06
-
0Is it true that determining if $n$ is a power of $10$ can be done in $O(\log n)$ time? I have no idea if it is... – 2017-01-06
-
0@pjs36 Yes, certainly this is obvious if $n$ is encoded in decimal :). If you are worried about $n$ being represented in binary which is more customary, there exist algorithms of complexity $O(\log n \log \log n)$ or thereabouts. But in that case just replace the middle $10$ by $4$ since detecting powers of $4$ is trivial in any reasonable bigint representation. – 2017-01-06
-
0@ErickWong I blushed a bit at "obvious" but I realized I was thinking it might be as bad as $O(n)$ to check, *starting at the $1$'s place*, whether there were a bunch of zeros. But I guess if we start at the *other* end... Either way, complexity is not remotely my specialty! :) (And it's good to know that this is a sound, and humorous, answer) – 2017-01-06
-
1@pjs36 Oh, it couldn't possibly be as bad as $O(n)$. Remember, the number $n$ has only $O(\log n)$ digits. You're right that this is linear-time, but since $n$ was specified to be the index, it's not the number of bits in the input. – 2017-01-06
2
Let $S$ be the set of all natural numbers starting with $11$ in some fixed base $b$ (if operating on a binary computer, pick $b=2$). Then $S$ does not have a natural density, which precludes it from being eventually periodic. Thus $\sum_{n\in S} 10^{-n}$ is irrational, and any digit can be computed in constant time for a reasonable representation of the index.