Scala Program that can only be executed using map function and not for yield construct?

I am trying to figure out a program that can only be done with map function and not for - yield function. I did figure out a program that can only done using for yield and it can’t be just done using map alone, it requires map and filter.

for {
  i <- 1 until n
  j <- 1 until i
  if isPrime(i + j)
} yield (i, j)

This is an example i found out from an online course. Similarly i am trying to figure out an example where it can be only run using map function and not for yield construct.

There isn’t one, period.

foo.map(f) can always be written like for { i <- foo } yield f(i) since the latter is just sugar syntax for the former.

Without for, this is equivalent to

(1 until n).flatMap { i =>
  (1 until i).filter(j => isPrime(i + j)).map(j => (i, j))
}

As Luis said, you can’t write it with just map.