Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I do not understand what you're trying to accomplish (computing the nine billions names of God ?).

I note that you are doing nothing with the result of do_calculations : it's neither used (to what ends ?), printed (where ?) nor stored (where ?).

For argument's sake, let's have a look at the size of problem. your elements are all the nine-long lists whose elements belong to [0, 1, 2, 3]. There are 4^9=262144 of them. Your (potential) table of results has therefore (4^9)^2=68719476736 elements (about seventy billions).

How much time is necessary to compute one element ? Let's see : pick two elements at random and operate on them. Using your original definitions in a Python3-based Sage :

sage: A=tuple(r.sample([0, 1, 2, 3], 9, replace=True).sage())
sage: B=tuple(r.sample([0, 1, 2, 3], 9, replace=True).sage())
sage: time(do_calculations(A,B))
CPU times: user 1.21 ms, sys: 0 ns, total: 1.21 ms
Wall time: 1.22 ms
[0, 0, 0, 0, 0, 1, 1, 1, 0]

You would need about (((4^9)^2)*1.22e-3).n(digits=3)=8.38e7 seconds (i. about (((4^9)^2)*1.22e-3/(24*60*60*365.25)).n(digits=3)=2.66 years) to perform the computations.

Storing the result (using an efficient encoding, i. e. two bits per element) but no previsible gain from string compressin algorithm (since your computation doesn't seem to have any special properties), you would need about 17.5 GB of storage.

Therefore, absent any "interesting" properties of your addition and multiply functions, inducing "interesting" symmetries (i. e. a structure) on the set of your nine-letter words, the "brute-force" approach is doomed.

May I suggest that using (a part of) 2.66 years to study the possible algebraic properties of your elements and operations might be more fruitful ?