#include "library.h" int length_collatz(const int N) { if (N == 1) return 1; if (N % 2 == 0) return 1 + length_collatz(N / 2); else return 1 + length_collatz(3 * N + 1); } void plot(const int current, const int maximum) { const int len = length_collatz(current); draw_point(current / 10, 600 - len); if (current < maximum) plot(current + 1, maximum); } void main() { make_window(800, 600); set_pen_width(4); plot(1, 8000); }