I just learned the Calculator app in Android Marshmallow does arbitrary precision arithmetic. I asked it for and it gave me the right answer to more than 500 decimals.

Skip to content
# Category: Numbers

## Bignums on the small screen

## Schizophrenic thinking

I just learned the Calculator app in Android Marshmallow does arbitrary precision arithmetic. I asked it for and it gave me the right answer to more than 500 decimals.

Advertisements

Some years ago I wrote up something about schizophrenic numbers. I read about these numbers in one of Clifford Pickover’s books, but he didn’t really get into what made them work the way they do, so I figured it out on my own. I posted it to the web. Now I can’t find a copy in my files or on my computer, and even the Internet Archive fails me — it didn’t archive it.

So I reconstructed it, more or less. I think.

The schizophrenic numbers are defined as follows. To start with we define

The first several are

and so on. Now the *m*th schizophrenic number is

Are any of the perfect squares (for ? No, they aren’t, as will become evident below. Therefore is the only rational in the set. The rest are irrational, so should be non-repeating decimals.

But let’s look at . Its value is

Wat.

It *can’t* be a rational number, unless it’s an integer, and it’s not an integer. What’s going on? Let’s get some more significant figures.

Oh, okay, that’s better. It’s not a repeating decimal after all…

Wat.

Um, okay?

**Wat.**

Seems not to be able to make up its mind whether to be rational or not. Hence schizophrenic. Here’s about 500 decimal places, broken up into “rational” and “irrational” pieces:

(I calculated that by hand. HA HA HA no actually I used a Python script, with the mpmath library.) The repeating pieces get shorter and shorter, the non-repeating pieces get longer and longer, and then (apparently) the repetition stops (aside from random repeats) and it finally starts behaving like we expect irrational numbers to do.

I mean, sure, we all know there *exist* an infinite number of irrationals that have arbitrarily large (but finite) numbers of repeating digits in them. But who’d expect behavior like this from the square root of an integer? What’s going on?

Well, observe that if then

So is a little smaller than . In particular you can see if you think about it, and you can prove inductively using the recurrence formula for , that

which means

Now you can use the Taylor series expansion

.

Here is , which for large is a bunch of zeros after the decimal point, followed by a few digits. In the expansion the terms after the first are powers of multiplied by an integer and divided by powers of 2, which for higher powers are *lots* of zeros after the decimal point, followed by some digits. The infinite sum gets divided by 9 — which turns the first term into and each of the following terms into zeros after the decimal point, followed by some digits, followed by some digit repeating to infinity — and then multiplied by which just shifts the decimal point. Look at the first few terms for :

For the first three terms, there are enough zeros in the subsequent term to preserve some of the repeating digits in the sum. The fifth term, though, scribbles over the repeating 4s in the fourth term, and so we only see three sets of repeating digits in :

But for larger , each term has more leading zeros due to the power of in the denominator, and more terms contribute repeating digits before the scribble-over point is reached. (And you get more and more 1s before and after the decimal point; in other words, you get closer and closer to a power of 10 times 1/9, so no, none of the corresponding are perfect squares.) I referred somewhat facetiously to “rational” and “irrational” pieces above, but it’s sort of true; the repeating digits are where you can see that there is a finite number of rational terms in the Taylor series contributing to the sum.

%d bloggers like this: