Smallest Prime with a Twist (A068103)
Java (OpenJDK 8), 164 110 bytes



a-&gt;{int i=0;for(;!(i+"").matches("2{"+a+"}.*")|new String(new char[i]).matches(".?|(..+)\\1+");i++);return i;}


Thanks to @FryAmTheEggman for a bunch of bytes!

Try it online!