Skip to main content
Counter into loop...
Source Link
rexkogitans
  • 647
  • 3
  • 10

Bash + GNU coreutils, 7566 Bytes

In contrast to @Doorknob's solution, this one only needs things that are installed on every GNU/Linux:

n=2
for((;;n=2;;n++)){
[ `factor $n|wc -w` -eq 2 ]&&grep $1<<<$n&&exit
n=$((n+1))
}

Bash + GNU coreutils, 75 Bytes

In contrast to @Doorknob's solution, this one only needs things that are installed on every GNU/Linux:

n=2
for((;;)){
[ `factor $n|wc -w` -eq 2 ]&&grep $1<<<$n&&exit
n=$((n+1))
}

Bash + GNU coreutils, 66 Bytes

In contrast to @Doorknob's solution, this one only needs things that are installed on every GNU/Linux:

for((n=2;;n++)){
[ `factor $n|wc -w` -eq 2 ]&&grep $1<<<$n&&exit
}
Source Link
rexkogitans
  • 647
  • 3
  • 10

Bash + GNU coreutils, 75 Bytes

In contrast to @Doorknob's solution, this one only needs things that are installed on every GNU/Linux:

n=2
for((;;)){
[ `factor $n|wc -w` -eq 2 ]&&grep $1<<<$n&&exit
n=$((n+1))
}