Skip to main content

Wolfram Language (Mathematica)Wolfram Language (Mathematica), 100 bytes

Nest[#+1//.i_/;!PrimeQ@FromDigits[##&@@#~Table~#&/@(l=IntegerDigits@i)]||Min@l<1:>NextPrime@i&,1,#]&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from JungHwan Min

-15 bytes from Martin Ender

also thanks to Jenny Mathy

Wolfram Language (Mathematica), 100 bytes

Nest[#+1//.i_/;!PrimeQ@FromDigits[##&@@#~Table~#&/@(l=IntegerDigits@i)]||Min@l<1:>NextPrime@i&,1,#]&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from JungHwan Min

-15 bytes from Martin Ender

also thanks to Jenny Mathy

Wolfram Language (Mathematica), 100 bytes

Nest[#+1//.i_/;!PrimeQ@FromDigits[##&@@#~Table~#&/@(l=IntegerDigits@i)]||Min@l<1:>NextPrime@i&,1,#]&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from JungHwan Min

-15 bytes from Martin Ender

also thanks to Jenny Mathy

added 44 characters in body
Source Link
user69552
user69552

[Wolfram Language (Mathematica)][1]Wolfram Language (Mathematica), 115100 bytes

(For[i=t=1,t<=#,PrimeQ@FromDigits[Join@@(#~Table~#&Nest[#+1/@(l=IntegerDigits)/.i_/;!PrimeQ@FromDigits[##&@@#~Table~#&/@(p=Prime)@i++)]&&l@p@i~FreeQ~0&&++t];p@--il=IntegerDigits@i)&]||Min@l<1:>NextPrime@i&,1,#]&

Try it online!Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from JungHwan Min [1]: http://%20https://www.wolfram.com/wolframscript/

-15 bytes from Martin Ender

also thanks to Jenny Mathy

[Wolfram Language (Mathematica)][1], 115 bytes

(For[i=t=1,t<=#,PrimeQ@FromDigits[Join@@(#~Table~#&/@(l=IntegerDigits)@(p=Prime)@i++)]&&l@p@i~FreeQ~0&&++t];p@--i)&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from JungHwan Min [1]: http://%20https://www.wolfram.com/wolframscript/

Wolfram Language (Mathematica), 100 bytes

Nest[#+1//.i_/;!PrimeQ@FromDigits[##&@@#~Table~#&/@(l=IntegerDigits@i)]||Min@l<1:>NextPrime@i&,1,#]&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from JungHwan Min

-15 bytes from Martin Ender

also thanks to Jenny Mathy

added 1 character in body
Source Link
JungHwan Min
  • 13.9k
  • 3
  • 23
  • 69

[Wolfram Language (Mathematica)][1], 115 bytes

(For[i=t=1,t<=#,PrimeQ@FromDigits[Join@@(#~Table~#&/@(l=IntegerDigits)@(p=Prime)@i++)]&&l@p@i~FreeQ~0&&++t];p@--i)&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from jungminhwanJungHwan Min [1]: http://%20https://www.wolfram.com/wolframscript/

[Wolfram Language (Mathematica)][1], 115 bytes

(For[i=t=1,t<=#,PrimeQ@FromDigits[Join@@(#~Table~#&/@(l=IntegerDigits)@(p=Prime)@i++)]&&l@p@i~FreeQ~0&&++t];p@--i)&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from jungminhwan [1]: http://%20https://www.wolfram.com/wolframscript/

[Wolfram Language (Mathematica)][1], 115 bytes

(For[i=t=1,t<=#,PrimeQ@FromDigits[Join@@(#~Table~#&/@(l=IntegerDigits)@(p=Prime)@i++)]&&l@p@i~FreeQ~0&&++t];p@--i)&

Try it online!

Jonathan Frech saved 3 bytes

and -7 bytes from JungHwan Min [1]: http://%20https://www.wolfram.com/wolframscript/

added 12 characters in body
Source Link
user69552
user69552
Loading
deleted 3 characters in body
Source Link
user69552
user69552
Loading
deleted 3 characters in body
Source Link
user69552
user69552
Loading
deleted 3 characters in body
Source Link
user69552
user69552
Loading
Source Link
user69552
user69552
Loading