All pastes #565050 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-13 21:06 UTC
rendered paste body
fun col n x =
		if n = 1 then (x+1)
		else if (n mod 2) = 0 then (col(n div 2) x+1)
		else (col(3*n +1) x+1);

fun max a b = 
	if a > b then a
	else b;

fun tnp1 i j =
	let fun loop i j f 
	in
		if i = j then max col j-1 0 col j 0
		else loop (i+1) j max col i col i+1
end;