## Monday, September 15, 2014

### How do you say π^π^π?

Well, not that you really probably want to know how to say such an absurdly large number. However for those of you who are interested (allowing for rounding) it is:

one quintillion, three hundred forty quadrillion, one hundred sixty-four trillion, one hundred eighty-three billion, six million, three hundred thirty-nine thousand, eight hundred forty

And yes you can find out how to write your very own absurdly long numbers as well in R! I have adapted John Fox's numbers2words function in order to allow for both absurdly long words as well as decimals. We can see some examples below:

> number2words(.1)
[1] "one tenths"
> number2words(94.488)
[1] "ninety-four and four hundred eighty-eight thousandths"
> number2words(-12187.1, proper=T)
[1] "minus twelve thousand, one hundred eighty-seven and one tenths"
[2] "12,187.1"
> number2words(123)
[1] "one hundred twenty-three"

You can find the code on github


1. Hmmm.. assuming you chose three exponentiations because round(pi)=3, here goes:
function(x) {y <-x; for (j in 1:(trunc(x)-1) ) y <- x^y; return(number2words(y)}

:-)

1. Yep no reason really to choose π^π^π. People seem to have some fascination with π.

2. Error in x %>% gsub("\n", " ", x = .) %>% strsplit(sep) %>% unlist %>% :
RHS appears to be a function name, but it cannot be found.

3. what's 'dpe' in your ttv function?

1. Sorry about that. Removed it. I think it should work fine now.

4. also see 'english' package

1. excellent point! I had not seen the package. However, try as.english("10001001000000000010010101001010120345667") or as.english(.123) and you will find that the above number2words will translate to english a larger set of numbers.