#include "library.h" const int width = 500, height = 500; int length_collatz(const int n) { if (n == 1) return 1; if (n % 2 == 0) return length_collatz(n/2) + 1; return length_collatz(n*3+1) + 1; } void experiment(const int start, const int stop) { const int y = length_collatz(start); move_to(start/10, height-y); draw_point(); if (start < stop) experiment(start+1, stop); } void main() { make_window(width, height); set_pen_width(3); experiment(1, width*10); }