So, rather than using $\pi$, is there any way that isn't overly complicated, (and can be calculated on a computer without taking a year) in which I could generate an infinite string of numbers that could ultimately contain any string of numbers?
Or, if this wouldn't work, do the same but only containing $0$'s and $1$'s?

Must also be able to generate the exact same string every time.

I know this may seem silly/specific for a question, but the idea is that you could find a long though not too large string of numbers, either with the digits $0$-$9$ (or $0$-$1$, using binary)

So, is this possible (in a realistic way) either in some method of $\pi$ or other formulas?

Also, I'm no mathematician, so please make sure to explain in a somewhat simple way.

Update: for instance, searching for $482744003642356604274627660076007$, would take a enormous amount of time and energy to find in pi, but I would like a method to easily find something like that.

I also appreciate all the help!

  • $\begingroup$ Also, if possible I would like this to be able to calculate on a computer at decent speed for generating it. $\endgroup$ – mathworks Jun 24 '15 at 5:06
  • 3
    $\begingroup$ I believe the status of $e$ is just like $\pi$ in this regard. "Everybody knows" that it includes all finite digit strings but there is no proof. $\endgroup$ – Ross Millikan Jun 24 '15 at 5:08
  • $\begingroup$ So, when I searched for that number in a online first 3 billion digits Pi, it couldn't find that number, though the sequence/formula I need must be able to easily find strings of numbers about that long, without needing a super computer to generate it. $\endgroup$ – mathworks Jun 24 '15 at 5:18
  • $\begingroup$ In 3 billion digits you should expect to find any 8 digit string and almost any 9 digit string, but the odds of getting a 15 digit string are very low and I showed 21 digits of this one. Pi is much longer than just 3 billion digits. Similarly, in the Champernowne constant you can find any finite string from pi, but you may have to look a long ways. $\endgroup$ – Ross Millikan Jun 24 '15 at 5:35
  • 1
    $\begingroup$ What do you need this for? One answer mentions the Champernowne constant .12345..., which certainly works but has no more or less content than just listing all decimal strings of length 1, 2, 3,... in a specific order and can't really be "defined" in any way other than its decimal expansion, so it seems useless. $\endgroup$ – KCd Jun 24 '15 at 13:19

The Champernowne constant $0.123456789101112131415\dots $ is guaranteed to have every finite string of digits represented, and asymptotically in the proper proportion. We do not know if $\pi$ satisfies that. It is also easy to compute any given digit. See this post for how.


$0.123456789101112131415...$ is the one such number. Given any string of $n$ digits, the density of occurrences of the string is the ideal $1/10^n$, I believe.


A (positive) real number is rational if it is the ratio of two whole numbers. When a number is presented as decimal expansion, a theorem states that, a number is rational if and only if, after some initial hiccups, the decimals start repeating in a cyclic manner.

So this theorem gives handle: The square roots, namely $\sqrt2,\sqrt3, \sqrt5,\ldots$ (avoiding the perfect squares) all are known to be irrational numbers, and hence by the above theorem any computational procedure should yield, like in the case of $\pi$, and infinite string of numbers between 0 to 9 without a cyclic pattern.

EDIT: I notice that you want every string to occur as a substring. There are definite algorithms to enumerate all binary strings of length $k$. For each length $k$, list it and string them together as a mega string running through $k=1,2,3,\ldots$ I think this is a binary variation of Ross Millikan's decimal version answer.

  • 1
    $\begingroup$ There are irrational numbers that do not include all digit strings. The original Liouville number is the prototypical example: $0.1100010000000\dots$, but you can also take the base $9$ expansion of $\sqrt 2$ and read it as a base $10$ number that includes no $9$'s. $\endgroup$ – Ross Millikan Jun 24 '15 at 5:07

An easy way to "Generate" long strings of numbers is to just roll a 10 sided dice (with numbers 0-9) and put the number which comes up in the current possition. So if you roll four times you may get a $3, 7, 6$ and a $3$ in which case you will get the number 3.763 .

Assymptotically i.e. when this process goes to infinity, you will have probability one of having each (finite) string of numbers in this sequence.

  • $\begingroup$ While that IS a good idea, I need it to be able to generate the exact same every time, even if generated on two completely different computers $\endgroup$ – mathworks Jun 24 '15 at 5:03
  • $\begingroup$ This defines a probability distribution over numbers, not a number. $\endgroup$ – David Richerby Jun 24 '15 at 10:16
  • $\begingroup$ @DavidRicherby The question is to find a way to generate an infinite string of numbers which contain all possible numbers as subsequence (read the first sentence of the question). The method I describe does exactly that, as your amount of flipped coins goes to infinity, you will get such a NUMBER. $\endgroup$ – Ove Ahlman Jun 24 '15 at 11:29
  • $\begingroup$ If you are going to roll an actual die, a problem is that it will wear up to the point of becoming unusable in finite time, for most strings way before they occurred for the first time. By using a pseudo random number generator, you can abstract away from such practical difficulties (assume an ideal computer). However you will also have the guarantee (for any actual PRNG) that not all strings will occur in the sequence it generates. So this really method has nothing to offer over the answers by Ross Millikan and Thomas Andrews. $\endgroup$ – Marc van Leeuwen Jun 24 '15 at 11:39
  • 1
    $\begingroup$ I don't agree. The question clearly askes for an (1) infinite, (2) reproducible, and (3) algorithmically generated string. Physical randomness gives you none of the three properties. Mathematical randomness does not really give anything because probability is just a theory about randomness. One could say: by a probabilistic (or other non constructive) argment normal numbers exist, so pick one and use that. This gives you (1) and (2), not (3). PRNGs give you all three, but fail the substring property. To summarise, randomness does not answer the question. $\endgroup$ – Marc van Leeuwen Jun 24 '15 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.