Advertisement
phillip1882

recurturtle

Jan 7th, 2025 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import turtle
  2. data = ["","","<>"]+[""]*1000000
  3. p = 1
  4. i = 2
  5. while i < 1000000:
  6.    if 1000000//i != 1:
  7.       for j in range(1,1000000//i):
  8.          if i*j >= 1000000:
  9.             break
  10.          data[i*j] = data[j] +data[i]
  11.    i += 1
  12.    while i<999998 and data[i] != "":
  13.       i += 1
  14.    p += 1
  15.    data[i] = "<" +data[p] +">"
  16. turtle.penup()
  17. turtle.right(90)
  18. turtle.forward(350)
  19. turtle.left(90)
  20. turtle.pendown()
  21. for i in range(2,4000):
  22.    print(data[i])
  23.    for j in range(0,len(data[i])):
  24.       if data[i][j] == "<":
  25.          turtle.left(30)
  26.       else:
  27.          turtle.right(45)
  28.       turtle.forward(3)
  29. input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement