Skip to main content
1 of 6
sergiol
  • 3.4k
  • 1
  • 15
  • 31

#tcl, 201

My still not golfed answer:

for {set i 2} {$i<$1000000} {incr i} {
    set p 1
    for {set j 2} {$j<$i} {incr j} {
        if {[expr $i%$j] == 0} {
            set p 0
            break
        }
    }

    if $p {puts $i}
}

demo

sergiol
  • 3.4k
  • 1
  • 15
  • 31