Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Sequence kolakoski python

539 views

Published on

  • Be the first to comment

  • Be the first to like this

Sequence kolakoski python

  1. 1. Kolakoski sequence n, sequence, pos, a = 0, [], 0, 1 while n < 2**20 : sequence.append(a) ; if sequence[pos] == 2 : sequence.append(a) n = n+1 a, n, pos = (a-2)**2+1, n+1, pos+1 from turtle import* screensize(100000, 100000) clear() ; reset() ; speed(999999) ; n=0 clear() ; reset() ; speed(999999) ; n=0 while n != 2**20: fd(sequence[n]) rt(sequence[n]) n=n+1 => Cercle while n != 2**20: fd(n/100) rt(sequence[n]) n=n+1
  2. 2. Pareil que pour la suite de Thue-Morse → c'est dû à la densité des deux suites, qui est égale à 0.5 Y a-t-il autant de changement de deux en deux que de non-changement ? while n != 2**20: fd(10) if sequence[n] != sequence[n+1] : rt(180-360/b) elif sequence[n] == sequence[n+1] : lt(180-360/b) n=n+1
  3. 3. Même question : while n != 2**20: rt(60) if sequence[n] != sequence[n+1] : fd(10) elif sequence[n] == sequence[n+1] : bk(10) n=n+1 while n != 2**20: rt(90) if sequence[n] != sequence[n+1] : fd(10) elif sequence[n] == sequence[n+1] : bk(10) n=n+1

×