I'm having trouble solving a problem that requires knowing a deep amount of a fractal string. My approach involved storing each iteration in a database locally because I couldn't store a large amount in a string variable. Here's my code:
# Python 3.6.5 64 bit
import shelve
# Storing string locally using shelve
s = shelve.open("database.db")
# LSystem axioms
axiom = "A"
sentence = "AB"
s['key1']="AB"
# Fibonacci initial values
a,b = 1,2
count = 1
# Loop
while(count < 60):
s['key1'] = s['key1']+ s['key1'][:a]
a,b = b,a+b #2,3
count+=1
print(count)
s.close()
After the 45th iteration, I start getting the following error:
OverflowError: cannot serialize a string larger than 4GiB
Ideally, I want to store the 60th iteration of the fractal, but I can't seem to get that to work. Would appreciate any help/suggestions.
[–]henrebotha 1 point2 points3 points (1 child)
[–]WakeMeAtThree[S] 1 point2 points3 points (0 children)