Skip to main content
added 5 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 3.8 with turtle, 156 127 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,x=0): while~-n:goto(w:=n,n:=[n//2,3*n+1][n%2]);x<1!=clear();setworldcoordinates(0,0,x:=max(x,n),x) 

Animation for \$a_1=27\$:

enter image description hereanimation of turtle for testcase 27

Python 3.8 with turtle, 156 127 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,x=0): while~-n:goto(w:=n,n:=[n//2,3*n+1][n%2]);x<1!=clear();setworldcoordinates(0,0,x:=max(x,n),x) 

Animation for \$a_1=27\$:

enter image description here

Python 3.8 with turtle, 156 127 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,x=0): while~-n:goto(w:=n,n:=[n//2,3*n+1][n%2]);x<1!=clear();setworldcoordinates(0,0,x:=max(x,n),x) 

Animation for \$a_1=27\$:

animation of turtle for testcase 27

deleted 23 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 3.8 with turtle, 156156 127 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,r=[],x=1x=0): while~-n:r+=ngoto(w:=n,;n=[nn:=[n//2,3*n+1][n%2];setworldcoordinates3*n+1][n%2]);x<1!=clear();setworldcoordinates(0,0,*[max(r)]*2) while r:goto(tx:=r.pop=max(x,n),x);x<2!=clear();x=t 

Animation for \$a_1=27\$:

enter image description hereenter image description here

Python 3.8 with turtle, 156 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,r=[],x=1): while~-n:r+=n,;n=[n//2,3*n+1][n%2];setworldcoordinates(0,0,*[max(r)]*2) while r:goto(t:=r.pop(),x);x<2!=clear();x=t 

Animation for \$a_1=27\$:

enter image description here

Python 3.8 with turtle, 156 127 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,x=0): while~-n:goto(w:=n,n:=[n//2,3*n+1][n%2]);x<1!=clear();setworldcoordinates(0,0,x:=max(x,n),x) 

Animation for \$a_1=27\$:

enter image description here

added 111 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164

Python 3.8 with turtle, 154156 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,r=[],x=1): while~-n:n=[nr+=n,;n=[n//2,3*n+1][n%2];r+=n, pu();setworldcoordinates3*n+1][n%2];setworldcoordinates(0,0,*[max(r)]*2) while r:goto(t:=r.pop(),x);x=t;pd;x<2!=clear();x=t 

Animation for \$a_1=27\$:

enter image description here

Python 3.8 with turtle, 154 bytes

from turtle import* def f(n,r=[],x=1): while~-n:n=[n//2,3*n+1][n%2];r+=n, pu();setworldcoordinates(0,0,*[max(r)]*2) while r:goto(t:=r.pop(),x);x=t;pd() 

Animation for \$a_1=27\$:

enter image description here

Python 3.8 with turtle, 156 bytes

Thanks to Noodle9 for catching a mistake!

from turtle import* def f(n,r=[],x=1): while~-n:r+=n,;n=[n//2,3*n+1][n%2];setworldcoordinates(0,0,*[max(r)]*2) while r:goto(t:=r.pop(),x);x<2!=clear();x=t 

Animation for \$a_1=27\$:

enter image description here

added 11 characters in body
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading
Source Link
ovs
  • 61.2k
  • 3
  • 49
  • 164
Loading