gets stdin n set i 0 while {$i<$n} {incr i set j 0 while {$j<$i} {incr j if {$i%$j<1} {lappend l $j}} puts $i:$l unset l}