Ask HN: Where can I run a Racket program that generates 1T random characters?

I'm doing a computational experiment to simulate "the infinite monkey theorem" with a Racket code that produces randomly the 26 letters in the English alphabet plus the space character. The program matches words in Hamlet and analyzes the outcome. The Racket code is here https://github.com/azeynel/infinite-monkey-racket/blob/main/hamlet-runs-6.rkt

I ran the code on my MacBook Pro for k=10 billion random characters and this took about half an hour. I calculated that running for k=1 trillion random characters will take about 3 days. This is not practical to do on my MacBook Pro.

What is your advice for running this code for k=1 trillion characters and possibly even more, preferably for free or very low cost.

In summary, I'm looking for advice on any of the following:

-Affordable or free computing resources where I could run this program.

-Cloud or academic computing services that might be available to independent researchers.

I'm based in Turkey. I contacted TRUBA, Turkey's high-performance computing center and Europe's EuroHPC JU, but did not receive a positive response.

Any suggestions would be very welcome.

2 points | by nyc111 2 hours ago

1 comments

  • ashu1461 2 hours ago
    Does this computational experiment offer any insights that cannot already be derived mathematically?
    • nyc111 1 hour ago
      This is what I’m trying to understand. The mathematical model does not take into account, for instance, that in “monkey English” space character has the same probability as all other letters (1/27 in our model). This is not the case in English.
      • shoo 1 hour ago
        along the lines that ashu1461 suggests, it should be possible to figure out the probabilities without using a computer, approaching it something like this:

        Define a 'word' to be any string of 1+ non-space characters generated by sampling letters from your chosen distribution (uniform distribution over the 27 symbols a-z + space).

        Given there is a word, what is the probability of it being:

        at least 1 letter long, at least 2 letters long, at least 3 letters long, at least 4 letters long, ...

        exactly 1 letter long, exactly 2 letters long, exactly 3 letters long, exactly 4 letters long, ...

        Once you can answer those in the general case, fix a specific length K English word. Given you have a length K 'word' where the letters have been sampled from the uniform distribution on a-z, what is the probability that this length K 'word' is equal to the word that you fixed?

        Given there are N English words of exactly length K in your chosen dictionary, given a length K 'word' where the letters have been sampled from the uniform distribution on a-z, what is the probability that this length K 'word' is equal to any of those N length K words in your dictionary?

        Once you've figured out the probability that the next random-letter 'word' is length K & the probability that a random-letter word of length K matches a world in your dictionary, for all lengths K that appear in your dictionary, that gives you a way to compute the probability that the next random-letter 'word' is in your dictionary regardless of its length. Your dictionary is finite so there's only a finite number of cases to analyse. Once you've got that, you can directly compute the probability of getting a run of M words in a row that are known to your dictionary. There's no need to sample any letters or store anything in ram.

        • nyc111 56 minutes ago
          >along the lines that ashu1461 suggests, it should be possible to figure out the probabilities without using a computer, approaching it something like this:

          @shoo: This may be the case, I’m on the road so I didn’t read what you wrote carefully, but I posted here hoping that there will be suggestions about how to run the Racket code for k=1 trillion. So not only probabilities but I’m also interested in the computational aspect of this project. I’ll read your comment later when I’m back at home