# What formulas are available to find the nth digit of a number?

Imagine that'd I'd like to investigate the digits of $\sqrt{2}$, or of any real number. If I want a formula for the nth digit of a real number $x$, we have,

$$(1) \quad \operatorname{d_n}(x)=\lfloor 10^{n-1} x \rfloor -10 \cdot \lfloor 10^{n-2} x \rfloor$$

Where $\lfloor y \rfloor$ denotes the floor function. However, I wish to be able to do more than just have a "formula". I wish for it to in some way, illuminate/pick-out the aspects that I want and destroy the information I don't want.

If I try expanding $(1)$ using a sine series, I get,

$$(2) \quad \operatorname{d_n}(x)={9 \over 2}+{1 \over {\pi}} \cdot \sum_{k=1}^{\infty} \left[ {1 \over k} \cdot \left( {\sin(2 \cdot 10^{n-1} \cdot \pi \cdot x \cdot k)-10 \cdot \sin(2 \cdot 10^{n-2} \cdot \pi \cdot x \cdot k)} \right) \right]$$

Is there anything simpler? Specifically, are there formulas that don't assume knowledge of the digit expansion of $x$?

I know that if a number can be written as,

$$(3) \quad x=\sum_{n=1}^{\infty} b^{-n} \cdot R(n)$$

And $R(n)$ goes to $0$ in the limit, then we can expand using $\{b^n \cdot x \}$ to pick out digits, but this is only useful if we have $b=10$. Plus it assumes that we neglect terms after $R(n)$ becomes "small" enough.

• Not all real numbers can have a "quick formula" to calculate the $n$th digit, because the programs that calculate digits are countable whereas the reals are uncountable. However the real numbers that can be "described" in some finite fashion are also countable, so this isn't an airtight argument for "describale" reals. If you're interested, you can look up calculating the $n$th digit of $\pi$ (at least in base 16), there are methods for doing this that are asymptotically much faster than just writing $\pi$ out to the $n$th digit. Probably various other real numbers have similar methods. – user2566092 Nov 3 '15 at 20:42
• @user2566092 I never say "quick formula" so the premise of your argument is kind of lacking. I only ask for simpler expansions, presumably ones that exist if an assumption is made on the nature of the number. But yes, I'm aware of the spigot algorithm. – Zach466920 Nov 3 '15 at 20:48
• I said "quick formula" because you asked about "formulas that don't assume knowledge of the digit expansion of $x$." That's all I meant, I was just intending to repeat what you said. – user2566092 Nov 3 '15 at 20:53
• That is not a soft question at all. From Wikipedia: "It is not known whether $\sqrt{2}$ can be represented with a BBP-type formula. " – Jack D'Aurizio Nov 3 '15 at 21:19