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.
I get that it is slow, but just run it and walk away for a long weekend. That timeframe isn't at all out of scope for some of the data transformation and migrations I've run in my career.
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.
@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
I'm not surprised, don't waste their time if you're not going to optimize your own code first; those supercomputers are for computationally irreducible problems, not something you'd have to wait even a few days for on a consumer machine. A machine, which by the way, is plenty fast enough, as I computed 1 trillion characters in 32 seconds on an M1 Pro, the same that you have as well it seems.
The main thing I did was rewrite it in Rust, and then utilized all the cores of the MacBook and generating the characters in big batches. There are comments if you want to read up more on each part.
https://play.rust-lang.org/?version=stable&mode=release&edit... (make sure it says Release before hitting Run, it does 1 billion by default). There's also a --verify flag that runs a straight line by line copy of your Racket loop on the same characters and checks every number matches exactly.