Ruby, 6262 61 bytes
->i{Prime.lazy.select{|x|map(&:to_s).grep(/#{i}/=~x.to_s}).first(i)[-1]}
Requires the -rprime
flag (+8 bytes).
->i{ # lambda with one argument
Prime # iterator over all primes
.lazy # make the iterator lazy (can't evaluate infinite primes)
.select{|x| map(&:x.to_s) # filterconvert overthe primes which...to strings
.grep(/#{i}/=~x.to_s) # containfind primes that regex match on the input as a(contain stringit)
}.first(i) # take the first (input) primes that satisfy this
[-1] # take the last of those
}