text:
Number in Number-squared
Consider a sequence of natural numbers for which N appears as a substring in N^2. A018834
Output the nth element of this sequence.
Rules
Program takes only n as input and outputs just one number - N.
The sequence can be 0-indexed or 1-indexed.
Sequence: 1 5 6 10 25 50 60 76 100 250 376 500 600 625 760 ...
Squares:  1 25 36 100 625 2500 3600 5776 10000 62500 141376 250000 360000 390625 577600 ...

This is code-golf so shortest code wins.

Is there any upper limit on the input?

@maxb No, for larger inputs, it should theoretically output the value.

A lot of implementations will run into problems (for me its due to not being able to create arrays with more than 2^32 values), which will make most solutions bound to a maximum size by default. Should these solutions be disqualified?

@maxb I think theoretically was meant as not necessarily practically.

@Arnauld the problem for my specific implementation was that I had an 8-byter which would solve until n=9, because create an array with 10^(input) values and filter it.

@maxb Normally limitations such as that are ignored if an implementation on hardware with, say, arbitrarily large integer sizes and memory quantity would function as expected with all inputs. (posted before the response - limited to 9 is low even in this case).

@Ourous I know it's really low, that's why I don't like my solution. I could add a byte and have it work for much bigger inputs, so I'll add that as an alternative

"N appears in N^2" would be better worded as something like "the decimal digits of N is a [contiguous] substring of the decimal digits of N squared" (11 does not "appear in" 121). [Strictly "contiguous" is redundant, but adding it is clear.]

@JonathanAllan Alternate suggested rewording: "N is lexicographically present in N^2"

Perl 6, 33 31 bytes
-2 bytes thanks to nwellnhof
{(grep {$^a²~~/$a/},1..*)[$_]}

Try it online!
Explanation:
{                            }  # Anonymous code block that returns
 (                      )[$_]   # The nth index of
  grep {          },1..*        # Filtering from the natural numbers
        $^a²                    # If the square of the number
            ~~/$a/              # Contains the number

05AB1E, 6 bytes
1-indexed
µNNnNå

Try it online!
Explanation
µ         # loop over increasing N until counter equals input
 N        # push N (for the output)
  Nn      # push N^2
    N     # push N
     å    # push N in N^2
          # if true, increase counter

That µ command is just... I wish I had that.

@maxb: It is quite practical for challenges where you need to find the Nth number that meets a specific condition.

"if true, increase counter"?

@JonathanAllan: As in, "If N is contained in N^2 increase the value of the counter by 1". I should probably have written "increment counter".

I actually didn't understand the explanation; it appears that if å yields true then we have the current N at the top of the stack (increment counter and increment N), but if not we continue (increment N). Maybe use something other than "N" since that is the final result in the question body :p

@JonathanAllan: Maybe adding and example of the stack content would help visualize.I don't really see the issue. After å is executed we have its result on the top of the stack and N under it. If å was true the program ends and N is displayed. If was false, the next iteration begins and the previous N gets left on the stack (but ignored).

The problems I had were 1) loop N vs N from the question and 2) thinking about stacks is not natural for me. I think it does make sense but would suggest x rather than N for the incrementing variable (and maybe label the counter something like i?)

@JonathanAllan: Ah OK, I didn't reflect on fact that N had a special meaning in the question. In my explanation, N always mean "current loop index". The counter is only mentioned as "counter". I'll see if I can reword it in a way that makes it clearer. The reason I call it N instead of x is that it is referred to as N in all 05AB1E documentation and calling it something else would be confusing (imo).

JavaScript (ES6), 43 bytes
f=(n,k=0)=>n?f(n-!!(++k*k+'').match(k),k):k

Try it online!

Non-recursive version, 47 bytes
n=>eval("for(k=0;n-=!!(++k*k+'').match(k););k")

Try it online!

This gives up to n=23 only?

@VedantKandoi It depends on the size of the call stack in your JS engine. But computing $a(n)$ requires $a(n)$ recursions, so that's $7600$ recursive calls for $n=23$.

MathGolf, 8 bytes (works for any input in theory, but only for n<10 in practice)
úrgÉ²ï╧§

Try it online!
Alternative (works for n<49 in practice and theory)
►rgÉ²ï╧§

The only difference is that instead of creating a list with 10^(input) values, I create a list with 10^6 items. This takes a while to run, so you could swap the first byte to any other 1-byte literal to test it out.
Explanation
ú          pop(a), push(10**a)
 r         range(0, n)
  g        filter array by...
   É       start block of length 3
    ²      pop a : push(a*a)
     ï     index of current loop
      ╧    pop a, b, a.contains(b)
           Block ends here
       §   get from array

The reason why this solution doesn't handle large input is that I noticed that the sequence grows less than exponentially, but more than any polynomial. That's why I used the 10**n operator (I wanted to use 2**n but it failed for input 1). That means that I create an extremely large array even for small inputs, just to filter out the vast majority of it, and then take one of the first elements. It's extremely wasteful, but I couldn't find another way to do it without increasing the byte count.

Common Lisp, 95 bytes
(lambda(n)(do((i 0))((= n 0)i)(if(search(format()"~d"(incf i))(format()"~d"(* i i)))(decf n))))

Try it  online!

Japt, 12 11 bytes
@aJ±X²søY}f

Try it
È²søY «U´}a

Try it

Clean, 83 bytes
import StdEnv,Text

(!!)[i\\i<-[1..]|indexOf(""<+i)(""<+i^2)>=0]

Try it online!
(!!)                               // index into the list of
 [ i                               // i for every
  \\ i <- [1..]                    // i from 1 upwards
  | indexOf (""<+i) (""<+i^2) >= 0 // where i is in the square of i
 ]

Java 8, 66 65 63 bytes
n->{int r=0;for(;!(++r*r+"").contains(r+"")||--n>0;);return r;}

-1 byte thanks to @Shaggy.
-2 bytes thanks to @Arnauld.
1-indexed.
Try it online.
Explanation:
n->{                // Method with integer as both parameter and return-type
  int r=0;          //  Result-integer, starting at 0
  for(;             //  Loop as long as:
       !(++r*r+"")  //    (increase result `r` by 1 first with `++r`)
                    //    If the square of the result `r` (as String)
        .contains(  //    does not contain
          r+"")||   //    the result `r` itself (as String):
       --n>0;);     //     (decrease input `n` by 1 first with `--n`)
                    //     And continue looping if input `n` is not 0 yet
  return r;}        //  Return the result `r`

65 bytes

@Shaggy Ah, of course. Thanks!

@Arnauld Ah, smart way of combining the loop and if! Thanks.

Jelly, 6 bytes
1ẇ²$#Ṫ

1-indexed.
Try it online!
How?
Finds the first n of the sequence as a list and then yields the tail, N.
1ẇ²$#Ṫ - Link: integer, n (>0)
1      - initialise x to 1
    #  - collect the first n matches, incrementing x, where:
   $   -   last two links as a monad:
  ²    -     square x
 ẇ     -     is (x) a substring of (x²)?
       -     (implicitly gets digits for both left & right arguments when integers)
     Ṫ - tail

If 0 were considered a Natural number we could use the 1-indexed full-program ẇ²$#Ṫ for 5.

Ruby, 45 bytes
->n,i=1{/#{i+=1}/=~"#{i*i}"&&n-=1while n>0;i}

Try it online!

Clojure, 81 bytes
(fn[n](nth(filter #(clojure.string/includes?(str(* % %))(str %))(range))n))

Try it online! (Unfortunately, TIO doesn't seem to support Clojure's standard string library)
If Clojure had shorter importing syntax, or had a includes? method in the core library, this could actually be somewhat competitive. clojure.string/includes? alone is longer than some answers here though :/
(defn nth-sq-subs [n]
  (-> ; Filter from an infinite range of numbers the ones where the square of
      ;  the number contains the number itself
    (filter #(clojure.string/includes? (str (* % %)) (str %))
            (range))

    ; Then grab the "nth" result. Inc(rementing) n so 0 is skipped, since apparently
    ;  that isn't in the sequence
    (nth (inc n))))

Since the TIO link is broken, here's a test run. The number on the left is the index (n), and the result (N) is on the right:
(mapv #(vector % (nth-sq-subs %)) (range 100))
=>
[[0 1]
 [1 5]
 [2 6]
 [3 10]
 [4 25]
 [5 50]
 [6 60]
 [7 76]
 [8 100]
 [9 250]
 [10 376]
 [11 500]
 [12 600]
 [13 625]
 [14 760]
 [15 1000]
 [16 2500]
 [17 3760]
 [18 3792]
 [19 5000]
 [20 6000]
 [21 6250]
 [22 7600]
 [23 9376]
 [24 10000]
 [25 14651]
 [26 25000]
 [27 37600]
 [28 50000]
 [29 60000]
 [30 62500]
 [31 76000]
 [32 90625]
 [33 93760]
 [34 100000]
 [35 109376]
 [36 250000]
 [37 376000]
 [38 495475]
 [39 500000]
 [40 505025]
 [41 600000]
 [42 625000]
 [43 760000]
 [44 890625]
 [45 906250]
 [46 937600]
 [47 971582]
 [48 1000000]
 [49 1093760]
 [50 1713526]
 [51 2500000]
 [52 2890625]
 [53 3760000]
 [54 4115964]
 [55 5000000]
 [56 5050250]
 [57 5133355]
 [58 6000000]
 [59 6250000]
 [60 6933808]
 [61 7109376]
 [62 7600000]
 [63 8906250]
 [64 9062500]
 [65 9376000]
 [66 10000000]
 [67 10050125]
 [68 10937600]
 [69 12890625]
 [70 25000000]
 [71 28906250]
 [72 37600000]
 [73 48588526]
 [74 50000000]
 [75 50050025]
 [76 60000000]
 [77 62500000]
 [78 66952741]
 [79 71093760]
 [80 76000000]
 [81 87109376]
 [82 88027284]
 [83 88819024]
 [84 89062500]
 [85 90625000]
 [86 93760000]
 [87 100000000]
 [88 105124922]
 [89 109376000]
 [90 128906250]
 [91 146509717]
 [92 177656344]
 [93 200500625]
 [94 212890625]
 [95 250000000]
 [96 250050005]
 [97 289062500]
 [98 370156212]
 [99 376000000]]

This should be able to support any value of n; providing you're willing to wait for it to finish (finding the 50th to 100th integers in the sequence took like 15 minutes). Clojure supports arbitrarily large integer arithmetic, so once numbers start getting huge, it starts using BigInts.

Edit (response to comments): Python 2, 76 bytes
Wanted to try for a non recursive method. (New to golfing, any tips would be great!)
def f(c,n=0):
    while 1:
        if`n`in`n*n`:
            if c<2:return n
            c-=1
        n+=1

Thanks both BMO and Vedant Kandoi!

You don't have to count print(f(13)) in the code. Also while 1:,if c==1:return n,c==1 can be c<2

Ah, I didn't see that you wanted a non-recursive version, nvm.. Anyway, I currently count 76 bytes not 79.

And you can save a few more: The spaces before & after \`` are redundant and the one after c<2:` too, next you can mix tabs and spaces for indentation (as shown here): 69 bytes Btw. there is no need to keep your old version (it's in the edit history for those who are interested) and why not link to TIO (or similar)/use the template from there?

Charcoal, 25 bytes
Ｎθ≔¹ηＷθ«≦⊕η¿№Ｉ×ηηＩη≦⊖θ»Ｉη

Try it online! Link is to verbose version of code. 0-indexed. Explanation:
Ｎθ

Input n.
≔¹η

Start N at 1. (Or, this could start counting at 0 which would make the input 1-indexed.)
Ｗθ«

Repeat until we have found n numbers in the sequence.
≦⊕η

Increment N.
¿№Ｉ×ηηＩη

If N*N contains N, then...
≦⊖θ»

... decrement n.
Ｉη

Print N.
My attempts at golfing this further were stymied by Charcoal a) not having an if..then except at the end of a block (which costs 2 bytes) b) not having a Contains operator (converting the output of Find or Count into a boolean that I could subtract from n again costs 2 bytes).

Python 2, 47 43 bytes
-4 bytes thanks to Dennis (adding 1 to recursive call instead of returning n-1)
f=lambda c,n=1:c and-~f(c-(`n`in`n*n`),n+1)

Try it online!
Explantion/Ungolfed
Recursive function taking two arguments \$c,n\$; \$n\$ is counts up \$1,2,3\dots\$ and everytime \$n \texttt{ in } n^2\$ it decrements \$c\$. The recursion ends as soon as \$c = 0\$:
# Enumerating elements of A018834 in reverse starting with 1
def f(counter, number=1):
    # Stop counting
    if counter == 0:
        return 0
    # Number is in A018834 -> count 1, decrement counter & continue
    elif `number` in `number ** 2`:
        return f(counter-1, number+1) + 1
    # Number is not in A018834 -> count 1, continue
    else:
        return f(counter, number+1) + 1

Haskell, 60 bytes
([n^2|n<-[1..],elem(show n)$words=<<mapM(:" ")(show$n^2)]!!)

Try it online!
      n<-[1..]              -- loop n through all numbers starting with 1
 [n^2|        ,    ]        -- collect the n^2 in a list where
     elem(show n)           -- the string representation of 'n' is in the list
       words ... (show$n^2) -- which is constructed as follows:

            show$n^2        -- turn n^2 into a string, i.e. a list of characters
          (:" ")            -- a point free functions that appends a space
                            -- to a character, e.g.  (:" ") '1' -> "1 "
        mapM                -- replace each char 'c' in the string (n^2) with
                            -- each char from (:" ") c and make a list of all
                            -- combinations thereof.
                            -- e.g. mapM (:" ") "123" -> ["123","12 ","1 3","1  "," 23"," 2 ","  3","   "]
      words=<<              -- split each element into words and flatten to a single list
                            -- example above -> ["123","12","1","3","1","23","2","3"]

(                      !!)  -- pick the element at the given index

APL (Dyalog Extended), 31 30 bytes
1∘{>⍵:⍺-1⋄(⍺+1)∇⍵-∨/(⍕⍺)⍷⍕⍺×⍺}

Try it online!
0-indexed.

(⍕⍺)⍷⍕ → ⍺⍷⍥⍕

I knew there was something I could do with that...

Perl 5 -p, 33 bytes
map{1while++$\**2!~/${\}/}1..$_}{

Try it online!

Lua, 137 123 79 bytes
-thanks @Jo King for 44 bytes
n=io.read()i=0j=0while(i-n<0)do j=j+1i=i+(n.find(j*j,j)and 1or 0)end
print(j*j)

Try it online!

79 bytes. Some generic tips; false/true can be 0>1/0<1, brackets aren't necessary for ifs and whiles, you can remove most whitespace after numbers (even newlines).

Tcl, 82 bytes
proc S n {while 1 {if {[regexp [incr i] [expr $i**2]]&&[incr j]==$n} {return $i}}}

Try it online!

I think you can mix the while and the if with:
proc S n {while {[incr j [regexp [incr i] [expr $i**2]]]-$n} {};return $i}

Tidy, 24 bytes
{x:str(x)in'~.x^2}from N

Try it online!
Returns a lazy list which, when called like a function, returns the nth element in the series.
Explanation
{x:str(x)in'~.x^2}from N
{x:              }from N       select all natural numbers `x` such that
   str(x)                      the string representation of `x`
         in                    is contained in
           '~.x^2              "~" + str(x^2)


text:
Self-contained powers
Given integer n, output the smallest exponent e greater than 1 such that n^e contains n as a substring.
For example, for 25, the answer should be 2, as 25 ^ 2 = 625, which contains 25 as a substring, but the answer for 13 should be 10, as 13 ^ 10 = 137858491849, so 10 is the lowest exponent for which the result contains 13 as a substring.
Rules

Standard I/O rules
Standard loopholes apply
Shortest code in bytes wins
n will always be an integer greater than 0

Test Cases
1 => 2   (1 ^ 2 = 1)
2 => 5   (2 ^ 5 = 32)
3 => 5   (3 ^ 5 = 243)
4 => 3   (4 ^ 3 = 64)
5 => 2   (5 ^ 2 = 25)
6 => 2   (6 ^ 2 = 36)
7 => 5   (7 ^ 5 = 16807)
8 => 5   (8 ^ 5 = 32768)
9 => 3   (9 ^ 3 = 729)
10 => 2  (10 ^ 2 = 100)
11 => 11 (11 ^ 11 = 285311670611)
12 => 14 (12 ^ 14 = 1283918464548864)
13 => 10 (13 ^ 10 = 137858491849)
14 => 8  (14 ^ 8 = 1475789056)
15 => 26 (15 ^ 26 = 3787675244106352329254150390625)
16 => 6  (16 ^ 6 = 16777216)
17 => 17 (17 ^ 17 = 827240261886336764177)
18 => 5  (18 ^ 5 = 1889568)
19 => 11 (19 ^ 11 = 116490258898219)
20 => 5  (20 ^ 5 = 3200000)
25 => 2  (25 ^ 2 = 625)
30 => 5  (30 ^ 5 = 24300000)
35 => 10 (35 ^ 10 = 2758547353515625)
40 => 3  (40 ^ 3 = 64000)
45 => 5  (45 ^ 5 = 184528125)
50 => 2  (50 ^ 2 = 2500)
55 => 11 (55 ^ 11 = 13931233916552734375)
60 => 2  (60 ^ 2 = 3600)
65 => 17 (65 ^ 17 = 6599743590836592050933837890625)
70 => 5  (70 ^ 5 = 1680700000)
75 => 3  (75 ^ 3 = 421875)
80 => 5  (80 ^ 5 = 3276800000)
85 => 22 (85 ^ 22 = 2800376120856162211833149645328521728515625)
90 => 3  (90 ^ 3 = 729000)
95 => 13 (95 ^ 13 = 51334208327950511474609375)
100 => 2 (100 ^ 2 = 10000)

Python script to generate the first 1000 answers

Related

A045537

Perl 6, 31 bytes
{$^a;first {$a**$_~~/$a/},2..*}

Try it online!

R, 69 44 bytes
function(n,i=2){while(!grepl(n,n^i))i=i+1;i}

Anonymous function. Works on large i when n is converted to BigZ (see TIO). Thanks for teaching me something Giuseppe and digEmAll!
Try it online!

61 bytes -- you had an extra space in n, ?n^i and paste converts to character by default :-)

56 bytes -- returning i should be sufficient.

44 bytes paste is not necessary, grepl converts to character by default :)

The problem is that it is "faulty" when exponents become big because of floating points accuracy and the fact that big numbers are converted to string in scientific notation. For instance 15 returns 17 while it should be 26. So, theoretically this works, but in practice we should use a Big Integer package or something like that...

@digEmAll I always forget that grep and friends do that...

@digEmAll for BigInt you could just force input to be a bigInt like BigZ from gmp and it should still work, except possibly for converting i to a bigZ as well

@Giuseppe: yep, using gmp works like a charm (no need to convert i) Try it online!

JavaScript (ES6 / Node.js),  41  40 bytes
Saved 1 byte thanks to @Shaggy
Takes input as a Number (works for \$n<15\$) or a BigInt literal.
n=>(g=x=>`${x*=n}`.match(n)?2:-~g(x))(n)

Try it online!

Ended up with a solution very similar to yours for 40 bytes

@Shaggy You need to use big integers, otherwise it wont return the correct answer in some test cases. At the end it has the same bytecount n=>(g=x=>${x*=n}.match(n)?2n:-~g(x))(n)

@LuisfelipeDejesusMunoz, generally we don't need to worry about precision issues but it will work with BigInts too.

Minor thing but if this uses BigInt shouldn't the title be JavaScript (Node.js)? ES6 doesn't have BigInt yet.

@ShieruAsakoto You're right. My initial intention was to explain that it works with either a Number or a BigInt. Now clarified.

APL (Dyalog Unicode), 25 23 17 bytes
-2 bytes thanks to @Erik the Outgolfer
-6 bytes thanks to @ngn
thanks to @H.PWiz for making the code not require a custom ⎕pp (print precision)
⊢⍟×⍣(∨/(⍕÷)⍷0⍕⊣)⍨

Try it online!
⊢⍟×⍣(∨/(⍕÷)⍷0⍕⊣)⍨
  ×⍣(          )⍨ generates a geometric progression by repeatedly multiplying the argument
                   by its original value
     ∨/(⍕÷)⍷0⍕⊣   the progression stops when this function, applied between the new and the
                   last old member, returns true
         ÷        the original argument (ratio between two consecutive members)
        ⍕         formatted as a string
           ⍷      occurrences within...
            0⍕    ...the formatted (with 0 digits after the decimal point)...
              ⊣   ...new member
     ∨/           are there any?
⊢⍟                use logarithm to determine what power of ⍵ we reached

This fails for 17 because it it finds 17 in  17^14=1.6837782655940093E17, but idk to what precision answers should support

@Cowsquack I just have to arbitrarily adjust ⎕PP I guess

Oh wait that won't even work

23 bytes.

19 bytes

@ngn ...that's amazing. I also honestly have no idea what half of it does. But  1+⍣ is ingenious.

here's an even shorter one but it requires a more modest ⎕pp because of floating point (im-)precision

@ngn Feel free to edit in an explanation if you want because I'm just cowering in awe rn :P

Pyth, 9 bytes
f}`Q`^QT2

Try it online!

Python 2, 42 41 bytes
-1 byte thanks to Ørjan Johansen (returning y directely)
f=lambda x,y=2:y*(`x`in`x**y`)or f(x,y+1)

Try it online!
Explanation/Ungolfed
Recursive function trying from \$2,3\dots\$ until we succeed:
# Start recursion with y=2
def f(x,y=2):
    # If we succeed, we arrived at the desired y
    if `x` in `x**y`:
        return y
    # Else we try with next y
    else:
        return f(x, y+1)

Try it online!

Returning y is shorter

@ØrjanJohansen: Weird, I thought I tried that, not exactly sure what I missed. Thanks a lot!

I had to swap the multiplication to avoid a space, maybe that was it?

@ØrjanJohansen: Probably that was it, yeah.

05AB1E, 7 bytes
∞>.Δm¹å

Try it online!
Explanation:
∞>.Δm¹å  //full program
∞        //push infinite list, stack = [1,2,3...]
 >       //increment, stack is now [2,3,4...]
  .Δ     //find the first item N that satisfies the following
     ¹   //input
      å  //is in
    m    //(implicit) input **  N

Brachylog, 8 bytes
;.^s?∧ℕ₂

Try it online!
Explanation
;.^         Input ^ Output…
   s?       …contains the Input as a substring…
     ∧      …and…
      ℕ₂    …the Output is in [2,+∞)

SAS, 71 66 bytes
Edit: Removed ;run; at the end, since it's implied by the end of inputs.
data a;input n;e=1;do until(find(cat(n**e),cat(n)));e+1;end;cards;

Input data is entered after the cards; statement, like so:
data a;input n;e=1;do until(find(cat(n**e),cat(n)));e+1;end;cards;
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Generates a dataset a containing the input n and the output e.

This looks to be a function definition, or equivalent (I assume actually a "macro") This means that requiring it be called with arguments (ie %p(n)) is totally fine, however output depends on whether macros in SAS can return values. If they can return, the "output" should be by returning the result, otherwise it should output it by whatever standard output method is supported

@Skidsdev Thanks for the feedback! SAS is a bit weird; macros aren't really functions, they're just a text substitution language that generates 'real' SAS code when compiled. I had a look at how other people have done I/O for SAS in codegolf, and edited my answer based on that, getting rid of the macro statements.

Jelly, 7 bytes
2ẇ*¥@1#

Try it online!

Clean, 99 bytes
import StdEnv,Text,Data.Integer
$n=hd[p\\p<-[fromInt 2..]|indexOf(""<+n)(""<+prod(repeatn p n))>=0]

Try it online!
If it doesn't need to work for giant huge numbers, then
Clean, 64 bytes
import StdEnv,Text
$n=hd[p\\p<-[2..]|indexOf(""<+n)(""<+n^p)>=0]

Try it online!

Java (OpenJDK 8), 84 bytes
Takes input as a String representing the number and outputs an int.
Most of the bytes come from the verbosity of the BigDecimal being needed to process the large numbers.
n->{int i=1;while(!(new java.math.BigDecimal(n).pow(++i)+"").contains(n));return i;}

Try it online!

How it works
This is fairly simple but I'll include the explanation for posterity;
n->{                                    // Lamdba taking a String and returning an int
    int i=1;                            // Initialises the count
    while(!                             // Loops and increments until
        (new java.math.BigDecimal(n)    // Creates a new BigDecimal from the input n
            .pow(++i)+"")               // Raises it to the power of the current count
            .contains(n)                // If that contains the input, end the loop
    );
    return i;                           // Return the count
}

PARI/GP 49 bytes
f(n)=e=1;until(#strsplit(Str(n^e++),Str(n))>1,);e

Try it online!

JavaScript (Node.js), 45 bytes
Test cases taken from @Arnauld's answer
a=>eval("for(i=1n;!(''+a**++i).match(a););i")

Try it online!

Ruby, 37 bytes
->n,i=2{i+=1until/#{n}/=~"#{n**i}";i}

Try it online!

Japt, 10 bytes
@pX søU}a2

Try it

Python 3, 63 58 bytes
def f(n,e=2):
	while str(n)not in str(n**e):e+=1
	return e

Try it online!
Python2 would probably be shorter, but I like using 3. Coming up wiht a lambda is difficult, but I'm trying a few things.

I dont know python but, isn't it shorter using lambda?

@LuisfelipeDejesusMunoz I started off trying to do that, but IDLE complained about having a bare while in a lambda. Maybe I can try some other ways..

Maybe some recursive function?

Defining e in the arguments-list (ie. def f(n,e=2)) and n**e should save some bytes, Python 2 would indeed save quite some bytes.

@LuisfelipeDejesusMunoz Lambdas are not like functions. The right hand side of a lambda has to be a single expression, and flow-control commands like for or while do not work.

@BMO that's -5, thanks. I forgot about the ** operator.

Charcoal, 19 bytes
Ｗ∨‹Ｌυ²¬№ＩΠυθ⊞υＩθＩＬυ

Try it online! Link is to verbose version of code. Explanation:
Ｗ∨‹Ｌυ²¬№ＩΠυθ⊞

Repeat until the the list length is at least 2 and its product contains the input...
⊞υＩθ

... cast the input to integer and push it to the list.
ＩＬυ

Cast the length of the list to string and implicitly print it.

C# (.NET Core), 104 89 bytes
a=>{int i=2;while(!(System.Numerics.BigInteger.Pow(a,i)+"").Contains(a+""))i++;return i;}

Try it online!
-1 byte: changed for loop to while (thanks to Skidsdev)
-14 bytes: abused C#'s weird string handling to remove ToString() calls
Need to use C#'s BigInteger library, as the standard numeric C# types (int, double, long, ulong, etc.) fail for some larger numbers (including 12, 15, and 17).
Ungolfed:
a => {
    int i = 2;                                          // initialize i

    while( !(System.Numerics.BigInteger.Pow(a,i) + "")  // n = a^i, convert to string
                                .Contains(a + ""))      // if n doesn't contain a
        i++;                                                // increment i

    return i;
}

You can save 1 byte by switching to a while loop

MathGolf, 10 bytes
ôkï⌠#k╧▼ï⌠

Try it online!
Explanation
This feels extremely wasteful, having to read the input explicitly twice, having to increment the loop counter twice.
ô            start block of length 6
 k           read integer from input
  ï          index of current loop, or length of last loop
   ⌠         increment twice
    #        pop a, b : push(a**b)
     k       read integer from input
      ╧      pop a, b, a.contains(b)
       ▼     do while false with pop
        ï    index of current loop, or length of last loop
         ⌠   increment twice

Ruby, 41 bytes
f=->n,a=n{(a*=n).to_s=~/#{n}/?2:1+f[n,a]}

Try it online!

Python 2, 47 bytes
i,e=input(),2
while`i`not in`i**e`:e+=1
print e

Try it online!
Inspired by @Gigaflop's solution.

Tcl, 69 81 bytes
proc S n {incr i
while {![regexp $n [expr $n**[incr i]]]} {}
puts $i}

Try it online!

Same byte count: https://tio.run/##DY7LaoNQFEXn6yt2IKOMzlGPj@/I0DooIs0FY8SmtCB@u72jvdkPWO9xPs91e426a1@UPuSH9t9Hmiftl36bvqa/VddFfdYtm9utT8u4KQ3DkJcH68/7W9d0nPPzc9WiHacQpahEiFo0opXohBvueO69xCs88Bpv8DZHHYVRBKVRBpVRBWFEUBt10BhN0Bpt0BldPpuRKe4Z7Dj/AQ

PowerShell(V3+), 67 bytes
function f{param($n)$i=1;do{}until([math]::pow($n,++$i)-match$n)$i}

Common Lisp, 78 bytes
(lambda(n)(do((e 2(1+ e)))((search(format()"~d"n)(format()"~d"(expt n e)))e)))

Try it online!

J, 26 bytes
2>:@]^:(0=[+/@E.&":^)^:_~]

Try it online!
NOTE: I've changed the final ] to x: in the TIO, to make the tests pass for larger integers.

Oracle SQL, 68 bytes
select max(level)+1 from dual,t connect by instr(power(x,level),x)=0

There is an assumption that source number is stored in a table t(x), e.g.
with t as (select 95 x from dual)

Test in SQL*Plus
SQL> with t as (select 95 x from dual)
  2  select max(level)+1 from dual,t connect by instr(power(x,level),x)=0
  3  /

MAX(LEVEL)+1
------------
          13

Ruby, 35 bytes
->n{(2..).find{"#{n**_1}"[n.to_s]}}

Attempt This Online!

Burlesque, 19 bytes
J2R@?^jbxq~[_+fi2.+

Try it online!
J    # Duplicate input
2R@  # Range (2..)
?^   # (in^2, in^3, ...)
j    # Put input to head of stack
bx   # Box
q~[  # Quoted contains
_+   # Push together (contains input)
fi   # Find the index which contains input
2.+  # Add 2 (0-indexed and 1 dropped)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Split Mark's marks
Challenge
Mark is a student who receives his N marks in a concatenated way in a one single line.
The challenge is to separate his marks, knowing that each mark can only be 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10.
Input
N natural number and one line.
Output
A set of natural numbers.
Example
N, One line------------------> Set of marks
3, '843'---------------------> [8, 4, 3]
1, '0'-----------------------> [0]
2, '1010'--------------------> [10,10]
3, '1010'--------------------> [1,0,10] or [10,1,0]
4, '1010'--------------------> [1,0,1,0]
9, '23104441070'-------------> [2, 3, 10, 4, 4, 4, 10, 7, 0]
12,'499102102121103'---------> [4, 9, 9, 10, 2, 10, 2, 1, 2, 1, 10, 3]
5, '71061'-------------------> [7, 1, 0, 6, 1]
11,'476565010684'------------> [4, 7, 6, 5, 6, 5, 0, 10, 6, 8, 4]
4, '1306'--------------------> [1, 3, 0, 6]
9, '51026221084'-------------> [5, 10, 2, 6, 2, 2, 10, 8, 4]
14,'851089085685524'---------> [8, 5, 10, 8, 9, 0, 8, 5, 6, 8, 5, 5, 2, 4]
11,'110840867780'------------> [1, 10, 8, 4, 0, 8, 6, 7, 7, 8, 0]
9, '4359893510'--------------> [4, 3, 5, 9, 8, 9, 3, 5, 10]
7, '99153710'----------------> [9, 9, 1, 5, 3, 7, 10]
14,'886171092313495'---------> [8, 8, 6, 1, 7, 10, 9, 2, 3, 1, 3, 4, 9, 5]
2, '44'----------------------> [4, 4]
4, '9386'--------------------> [9, 3, 8, 6]

Rules

When several outputs are possible give only one output.
Only mark of value 10 is on two decimal, others are on one decimal.
The input and output can be given in any convenient format
No need to handle invalid input
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
If possible, please include a link to an online testing environment so other people can try out your code!
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Here's a Python snippet I used to get the n, 'string' pairs from the copypasted example text block: spl = [item.split('-')[0] for item in text.split('\n')]

Plz some comments for down-votes...

Downvotes don't require leaving comments for a reason. There is nothing that can be improved about this challenge.

So don't worry about it.

Are the outputs required to be in the same order as the input?

@Mnemonic any order is accepted. The output is considered as a set.

Can we get a list of digits instead of a string?

@EriktheOutgolfer yes of course it is a convenient format

Brachylog, 23 21 bytes
-2 bytes thanks to Fatalize
h~c.{ịℕ≤10&ịṫ?∧}ᵛ&t~l

Try it online!
The input is a pair [Line, N].
This is my first Brachylog program, so there is probably a lot room for improvement.
It is very slow when the length of the line > 7.
Explanation:
h~c.{ịℕ≤10&ịṫ?∧}ᵛ&t~l
h                         The first element in the input
 ~c                       is formed by concatenating
   .                      the elements in the output array
   .{         ∧}ᵛ     AND For every element in the output array holds that
     ị                      The element converted to an integer
      ℕ                       is a natural number
       ≤10                    and less than or equal to 10
          &ịṫ?              and it has no leading zeroes (*)
                 &t   AND The second element of the input
                   ~l     is the length of the output

(*) ịṫ? checks that there are no leading zeroes. It converts the string to integer and then back to string and compares to the original string.

You don't need to input the number as a string, just use an integer. This alleviates the need for all those ị and for the leading zero check: h~c.{ℕ≤10}ᵛ&t~l. This is probably slower though as deconcatenation on integers must work even for unknown integers through constraints, which makes it inefficient.

(Also note that using h and t to get the first/last element is more efficient than using ∋ for both (which in most programs will not even work)).

@Fatalize I understood that the input line can contain leading zeroes, so it would not be possible to use an integer as the input.

Right, that's annoying…

V, 17, 12 bytes
\ÓòÀGjí1“î…0

Try it online!
I was content with 17 bytes, but than 05AB1E came along with 13, and I couldn't let a challenge go unanswered. :D
\Ó                      " Put each character on it's own line
  ò                     " Recursively (repeat until an error happens)...
   ÀG                   "   Go to the "n"th line
     j                  "   Move down a line (this will error if there are exactly "n" lines)
      í                 "   Remove...
       1                "     a '1'
        <0x93>          "     START THE MATCH HERE
              î         "     a newline
               <0x85>   "     END THE MATCH HERE
                   0    "     a '0'

Hexdump:
00000000: 5cd3 f2c0 476a ed31 93ee 8530            \...Gj.1...0

Alternate solution:
\ÓòÀGjç1î0/J

Unfortunately, this replaces 10 with 1 0

Perl 6, 25 bytes
->\a,\b{b~~/(10|.)**{a}/}

Try it online!
Anonymous code block that takes a number and a string and returns as a Match object.
Explanation:
->\a,\b{                }  # Anonymous code block taking params a and b
        b~~/           /   # Match using b
            (10|.)           # 10 or a single digit
                  **{a}      # Exactly a times, being greedy

Python 3, 47 bytes
lambda s,n:[*s.replace(b'\1\0',b'\n',len(s)-n)]

Try it online!
Takes the "one line" as a bytestring with raw bytes \x00 - \x09. If it's not acceptable:
Python 3, 56 bytes
lambda s,n:[x-48for x in s.replace(b'10',b':',len(s)-n)]

Try it online!
Takes "one line" as bytestring.

Python 3, 71 68 59 bytes
down another 9 bytes thanks to ovs.
lambda n,s:[int(c,11)for c in s.replace('10','a',len(s)-n)]

Try it online!
I was iniitially trying to use str.partition() recursively, but using replace smacked me in the face not too long after. Can anyone improve on this?
Also, here's a TIO link that I used to make the test cases into something more copy/pasteable

-3 bytes: drop space between : [c and 'x' else and 10 for

@mdahmoune Thanks for noticing, I have a hard time remembering what can be squished together.

General rule of thumb: Basically anything except for two letters can be squished together. If you get a syntax error, add random spaces until it works :)

There are some exceptions such as <number>e, <letter><number>, f'.

59 bytes by replacing 10 with a and reading each character as a base 11 int: lambda n,s:[int(c,11)for c in s.replace('10','a',len(s)-n)].

@ovs That's a really neat trick, thanks!

Ruby, 57 bytes
->n,m{m.sub!"10",?A while m[n];m.chars.map{|c|c.to_i 16}}

Try it online!
This may turn out to be not the golfiest approach, but it looks like a fun idea to temporarily substitute 10 for a hex A, which incidentally is also a high mark (if we consider A-F grading system :))

JavaScript, 57 52 bytes
n=>g=s=>s[n]?g(s.replace(x=10,`x`)):[...s].map(eval)

Try It Online

Haskell, 68 bytes
n!('1':'0':x)|n-2<length x=10:(n-1)!x
n!(s:x)=read[s]:(n-1)!x
n!_=[]

Try it online!
Greedily take 10s as long as there are more digits than marks remaining.

Haskell, 98 bytes
n!x=[y|y<-s x,y==take n y]!!0
s('1':'0':x)=do y<-s x;[1:0:y,10:y]
s(x:y)=(read[x]:)<$>s y
s _=[[]]

Try it online or test all!
Explanation
The function s does all possible splits, for example: "1010" becomes [[1,0,1,0],[10,1,0],[1,0,10],[10,10]], note how the longest splits end up at the beginning (because 1:0:y comes before 10:y).
With that in mind, we can take all these values and filter the ys out where y == take n y which keeps also splits that are shorter than required. For example with 4 we leave the list the same [[1,0,1,0],[10,1,0],[1,0,10],[10,10]].
Now we can just get the first element in that list because the inputs will always be valid (eg. 5!"1010" would give [1,0,1,0] too, but we don't need to handle it).
Note: I somehow miscounted.. y==take n y is the same length as length y==n :S

R, 63 bytes
While the length of the string is larger than n, substitute the next 10 you reach for a ":" (the ASCII character after 9). Then split into numbers by taking the ASCII value of each char in the string.
function(n,x){while(nchar(x)>n)x=sub(10,":",x);utf8ToInt(x)-48}

Try it online!

JavaScript (Babel Node),  70 69  59 bytes
Takes input as (n)(line).
n=>s=>(a=s.match(/10|./g)).flatMap(x=>x>9&&!a[--n]?[1,0]:x)

Try it online!
Commented
n => s =>                       // given n and s
  (a = s.match(/10|./g))        // split s into marks; a '1' followed by a '0' is always
                                // interpreted as '10'
  .flatMap(x =>                 // for each mark x:
    x > 9 &&                    //   if x = '10',
    !a[--n] ?                   //   then decrement n; if a[n] is undefined:
      [1, 0]                    //     yield [1, 0]
    :                           //   else:
      x                         //     yield the mark unchanged
  )                             // end of flatMap()

JavaScript (ES6),  64  59 bytes
Saved 5 bytes thanks to @guest271314
Takes input as (n)(line).
n=>g=([...s])=>1/s[n]?g(eval(`[${s}]`.replace('1,0',10))):s

Try it online!
Commented
n =>                            // main function, taking n
  g = ([...s]) =>               // g = recursive function, taking s
                                //     (which is either a string or an array)
    1 / s[n] ?                  // if s[n] is defined (i.e. we have too many marks):
      g(                        //   do a recursive call to g:
        eval(                   //     build a new array by evaluating ...
          `[${s}]`              //       ... the string representation of s[] where the
          .replace('1,0', 10)   //       first occurrence of '1,0' is replaced with '10'
        )                       //     end of eval()
      )                         //   end of recursive call
    :                           // else:
      s                         //   return s

Why the output for N=3 and line='1010' is with mixed types [ 1, 0, '10' ]?

s.match() returns an array of strings but a "10" may be split into [1,0] (2 integers) in the callback function of flatMap().

We can coerce everything to integers for +1 byte.

59 bytes eval(\[${s}]`.replace('1,0',10))`

@guest271314 Thanks! Nice catch.

Perl 5 -plF, 39 bytes
$a=<>;$_="@F";s/1 0/10/ while$a-1<y/ //

Try it online!

Clean, 128 bytes
import StdEnv
@[]=[[]]
@['10':t]=[u++v\\u<-[[10],[1,0]],v<- @t];@[h:t]=[[digitToInt h:v]\\v<- @t]
?n l=hd[e\\e<- @l|length e==n]

Try it online!

05AB1E, 13 bytes
.œsù.ΔïTÝÃJ¹Q

Try it online!
or as a Test Suite
Explanation
.œ              # partitions of the first input
  sù            # of a length equal to the second input
    .Δ          # find the first partition that returns true when:
      ï         # each element is converted to integer
       TÝÃ      # and only numbers in [0 ... 10] are kept
          J     # then join it together
           ¹Q   # and compare it to the first input for equality

Java (OpenJDK 8), 78 bytes
A nice one-liner using the streams API.
(n,l)->l.join(":",l.split("10",l.length()-n+1)).chars().map(i->i-48).toArray()

Try it online!

How it works
(n,l)->                     // Lambda function taking int and string
  l.join(":",               // Join the following array with colons
    l.split("10",           // Split the original string on "10"...
      l.length()-n+1))      // But limit the parts to the difference between the length
                            // and expected length, to only remove  required number of 10s
  .chars()                  // Convert to an intstream of codepoints
  .map(i->i-48)             // Remove 48 to get the numeric value of each codepoint
  .toArray()                // Return an int array

Red, 91 bytes
func[n s][while[n < length? s][replace s"10""a"]foreach c s[prin[either c =#"a"[10][c]""]]]

Try it online!

Jelly, 18 bytes
Ḍ⁵⁻ƊƝr1ŒpS‘⁼ɗƇḢk⁸Ḍ

Try it online!

Stax, 11 bytes
ô 0┤'ï╒Äì√¡

Run and debug it
It was very interesting to find a way to outgolf the V answer.
Explanation
|!{11rJj-!}jJ
|!            all array partitions of length n
  {       }j  first element which satisfies:
   11r        range 0-10
      J       joined with spaces
       j      split on spaces
        -     set difference with the current iteration
         !    negated
              is true?
            J join with spaces

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Print a square!
Print this text:
 _________
|         |
|         |
|         |
|_________|

Shortest code wins. Notice the space at the start of the first line.

Welcome to PPCG. Is there anything that makes this challenge interesting compared to all the other [tag:kolmogorov-complexity] challenges we already have?

PowerShell, 40 37 bytes
" "+($x="_"*9)
,"|$(" "*9)|"*3
"|$x|"

Try it online!

Charcoal, 12 bytes
←×⁵_↑⁴ ×⁵_‖Ｏ

Try it online! Link is to verbose version of code. Sadly the vertical direction is insufficiently symmetric to make it worthwhile reflecting. Explanation:
←×⁵_

Print 5 _s, leaving the cursor to the left of the first _. This makes up half of the bottom of the square.
↑⁴

Print 4 |s upwards, making the left of the square.
 ×⁵_

Print a space and 5 _s, making half of the top of the square.
‖Ｏ

Reflect to complete the square.

J, 24 bytes
<3 9$LF[9!:7' |_'#~6 4 1

Try it online!

Canvas, 9 bytes
Ｉ×⁹-x~‰‟│

Try it here!
Compression. Less boring 12-byte answer:
２|＊５_×＋⇵ ∔↕╪

2|*           repeat "|" vertically 2 times
   5_×        repeat "_" horizontally 5 times
      +       add the two together horizontally
       ⇵      reverse the canvas vertically
         ∔    prepend a space (because otherwise it glitches out :|)
          ↕   reverse vertically, moving the underscores up
           ╪  quad-palindromize, moving underscores as needed

Try it here!

05AB1E, 24 22 21 bytes
ð'_9×«ð9×'|.ø4и`ð'_:»

Try it online!

Dangit Okx.. And here I was so happy with my Canvas answer being shorter than the compression I usually use for KC challenges. +1 though, nice shorter alternative!

Btw, you can remove the ©, since you don't use it anywhere. And the 5 should be a 4. PS: If you want to use the Elixir rewrite instead of Python legacy, replace the * with ×. Multiply with strings coincidentally works in the Python legacy version, but was never intended to. Bit of a bug disguised as 'feature'.

@KevinCruijssen Fixed and golfed off a byte

My biggest problem with the new 05AB1E is that the debug feature is terrible

Yeah, I can only agree on that.. I switch a lot back to the legacy in order to use -d. You do get a bit more information when using --debug-stack instead of -d in the Elixir rewrite version, but still not as much or as good as with the legacy debugger -d..

Personally I debug by putting = where I think there's a problem. I used to use -d... just rechecked it, but now it's seemingly worse than I remember. I used to just post debug logs as the explanation at times.

Also, random note, here's a numerical way to do it (worse than yours): ₄т*xsD1 6×+Ð)À.º»2ÝJ…_ |‡ but about 50x more convoluted.

Python 2, 41 bytes
a=' '
for b in'_   _':print a+9*b+a;a='|'

Try it online!
Changes the outer character from ' ' to '|' after the first line using an assignment, a simple trick I don't remember seeing in an ASCII art golf before.

05AB1E, 27 21 bytes (using compression and mirror)
…_ |•ʒßKèËß•3вèJ5ä».º

Straightforward approach.
Try it online.
Explanation:
…_ |        # Push string "_ |"
•ʒßKèËß•    # Push compressed integer 68865864629382
 3в         # Convert to Base-3 as list
            #  [1,0,0,0,0,0,2,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,0,0,0,0,0]
   è        # Index each into the string
            #  [" ","_","_","_","_","_","|"," "," "," "," "," ","|"," "," "," "," "," ","|"," "," "," "," "," ","|","_","_","_","_","_"]
    J       # Join all characters together
            #  " _____|     |     |     |_____"
     5ä     # Split the string into 5 equal-sized substrings
            #  [" _____","|     ","|     ","|     ","|_____"]
       »    # Join them by newlines
            #  " _____\n|     \n|     \n|     \n|_____"
        .º  # Mirror with overlap (and output implicitly)
            #  " _________ \n|         |\n|         |\n|         |\n|_________|\n"

See this 05AB1E tip of mine (section How to compress integer lists?) to understand why •ʒßKèËß•3в is [1,0,0,0,0,0,2,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,0,0,0,0,0].

05AB1E, 28 26 bytes (using the Canvas)
'_9∍ð'|4∍JDðKðJŽWêSÌsŽ9¦SΛ

I like this approach a lot more, but unfortunately it's a bit longer.. This approach uses the Canvas builtin Λ.
Try it online.
Explanation:
'_9∍      '# Push string "_" and enlarge it to size 9: "_________"
ð          # Push a space character
'|4∍      '# Push string "|" and enlarge it to size 4: "||||"
J          # Join the entire stack together to a single string
D          # Duplicate it
ðK         # Remove the space
ð          # Push a space character
J          # Join all the entire stack together to a single string
           # (We now have "_________ ||||_________|||| ")
ŽWê        # Push compressed integer 8393
   S       # Convert it to a list of digits: [8,3,9,3]
    Ì      # Add 2 to each: [10,5,11,5]
s          # Swap the list and string on the stack
Ž9¦        # Push compressed integer 2460
   S       # Convert it to a list of digits: [2,4,6,0]
Λ          # Use the Canvas with options (and output immediately implicitly):
           #  [10,5,11,5] as lengths
           #  "_________ ||||_________|||| " as string to draw
           #  [2,4,6,0] as directions, which is [left,down,right,up] respectively

Here a few alternatives for creating the strings ('_9∍ð'|4∍JDðKðJ) with the same amount of bytes:

ð'|4×'_5×©Jû®ûì: Try it online.
'_9∍Dðs'|4∍.øðJ: Try it online.

Java 11, 57 bytes
v->" _________\n"+"|         |\n".repeat(3)+"|_________|"

Try it online.
I don't think this requires an explanation.. >.>

Hi, I am new to golfing. Can you explain where is the print statement here? Thank for your help.

@isaace Hi there and welcome to PPCG! We have some default rules that apply to all challenges (unless explicitly stated differently). For example, these loopholes are forbidden by default; and you are allowed to use any default I/O method. This means that you are allowed to use functions instead of full programs, and you're also allowed to return a string instead of printing something to STDOUT directly. Since Java is pretty verbose, I use both those alternatives in my answer.

ok, thank you for the explanation!

@isaace The shortest full program that prints directly to STDOUT would have been interface M{static void main(String[]a){System.out.print(" _________\n"+"|         |\n".repeat(3)+"|_________|");}}. Since all Java programs need a mandatory main method and enclosing class/interface, it's (almost) always shorter to use a (Java 8+ lambda) function instead. In addition, it's shorter to return a String instead of printing with System.out.print in this case. Hope that clears it up a bit. :)

Python 2, 54, 53, 50, 48 bytes
print' '+'_'*9+'\n|         |'*3+'\n|_________|'

-1 Thanks to Kevin Cruijssen.
-3 Thanks to Okx
-2 Thanks to Vedant Kandoi

You can remove the trailing space on the first line (+' \n' to +'\n') to save a byte.

@KevinCruijssen whoops! Thanks for spotting that!

50 bytes if you move around the newlines: print' '+'_'*9+('\n|'+' '*9+'|')*4+'\n|'+'_'*9+'|'

48 bytes: print' '+'_'*9+'\n|         |'*5+'\n|_________|', 9 spaces between | and |

@Okx ahh good spot!

@VedantKandoi thanks loads!

Canvas, 19 bytes
“5＋║³╵∑O：E`}7╴？Ｂ<‟│

Try it here!

oh, there was already a canvas compression answer.. Either way the input string to compression I gave was " _____¶|¶|¶|¶|_____" - trailing spaces are automatically added, and splitting the input in multiple lines just worsens its compression ability

C# (.NET Core), 66 bytes
Console.Write(" {0}\n|{1}{1}{1}{0}|","_________","         |\n|");

Try it online!

Prints the first argument of Console.Write()
{0} refers to the second argument ("_________")
{1} refers to the third argument ("         |\n|").

Turing Machine But Way Worse - 3251 bytes
0 0 0 1 1 0 0
0 1 0 1 2 0 0
0 2 1 0 3 1 0
0 3 1 0 4 0 0
0 4 0 1 0 0 0
1 0 1 1 1 0 0
1 1 0 0 2 0 0
1 2 1 1 5 0 0
0 5 0 1 6 0 0
0 6 1 0 7 0 0
0 7 0 1 3 0 0
1 3 1 1 8 0 0
0 8 1 0 4 0 0
1 4 1 1 5 0 0
1 5 1 1 9 0 0
0 9 1 0 6 0 0
1 6 1 1 7 0 0
1 7 1 1 10 0 0
0 10 1 1 11 0 0
0 11 1 0 8 1 0
1 8 1 0 9 1 0
1 9 1 0 10 1 0
1 10 1 0 11 1 0
1 11 1 1 12 1 0
1 12 1 0 13 1 0
1 13 1 1 14 1 0
1 14 1 0 15 1 0
1 15 1 1 16 1 0
1 16 1 1 17 0 0
1 17 0 1 18 0 0
1 18 1 1 19 0 0
1 19 0 0 20 0 0
1 20 1 0 12 0 0
0 12 0 0 21 0 0
1 21 1 0 22 0 0
1 22 0 0 13 0 0
0 13 0 0 23 0 0
1 23 0 0 14 1 0
0 14 0 1 15 0 0
0 15 1 0 16 0 0
0 16 0 1 24 0 0
1 24 1 1 17 0 0
0 17 1 0 25 0 0
1 25 1 1 26 0 0
1 26 1 1 18 0 0
0 18 1 0 27 0 0
1 27 1 1 28 0 0
1 28 1 1 29 0 0
1 29 1 1 19 0 0
0 19 1 1 30 0 0
1 30 0 0 31 1 0
1 31 0 0 32 0 0
1 32 0 0 33 0 0
1 33 0 0 34 0 0
1 34 1 0 35 0 0
1 35 0 0 20 1 0
0 20 0 1 21 1 0
0 21 0 1 36 1 0
1 36 1 1 22 1 0
0 22 0 1 23 1 0
0 23 0 0 24 1 0
0 24 0 1 25 1 0
0 25 0 0 26 1 0
0 26 0 1 27 1 0
0 27 1 1 28 0 0
0 28 1 0 37 0 0
1 37 1 0 29 0 0
0 29 1 0 38 0 0
1 38 1 0 30 0 0
0 30 1 0 31 1 0
0 31 0 1 39 0 0
1 39 0 0 32 0 0
0 32 0 1 33 0 0
0 33 0 1 40 0 0
1 40 0 0 34 0 0
0 34 0 1 35 0 0
0 35 0 1 41 0 0
1 41 0 0 36 0 0
0 36 0 1 37 0 0
0 37 0 1 42 0 0
1 42 1 1 43 0 0
1 43 0 1 38 0 0
0 38 1 0 39 1 0
0 39 1 1 44 0 0
1 44 0 0 45 0 0
1 45 1 0 46 0 0
1 46 1 0 40 0 0
0 40 1 0 41 0 0
0 41 1 0 42 0 0
0 42 1 0 43 1 0
0 43 0 1 47 0 0
1 47 0 0 44 0 0
0 44 0 1 45 0 0
0 45 0 1 48 0 0
1 48 1 1 49 0 0
1 49 0 0 50 0 0
1 50 1 1 46 0 0
0 46 0 1 51 0 0
1 51 0 1 52 0 0
1 52 0 0 47 1 0
0 47 0 0 48 1 0
0 48 0 1 49 1 0
0 49 0 0 50 1 0
0 50 0 1 51 1 0
0 51 0 0 52 1 0
0 52 0 1 53 1 0
0 53 0 0 54 1 0
0 54 0 1 55 1 0
0 55 1 1 56 0 0
0 56 1 0 53 0 0
1 53 1 0 57 0 0
0 57 1 0 54 0 0
1 54 1 0 58 0 0
0 58 1 0 59 1 0
0 59 0 1 55 0 0
1 55 0 0 60 0 0
0 60 0 1 61 0 0
0 61 0 1 56 0 0
1 56 0 0 62 0 0
0 62 0 1 63 0 0
0 63 0 1 57 0 0
1 57 0 0 64 0 0
0 64 0 1 65 0 0
0 65 0 1 58 0 0
1 58 1 1 59 0 0
1 59 0 1 66 0 0
0 66 1 0 67 1 0
0 67 1 1 60 0 0
1 60 0 0 61 0 0
1 61 1 0 62 0 0
1 62 1 0 68 0 0
0 68 1 0 69 0 0
0 69 1 0 70 0 0
0 70 1 0 71 1 0
0 71 0 1 63 0 0
1 63 0 0 72 0 0
0 72 0 1 73 0 0
0 73 0 1 64 0 0
1 64 1 1 65 0 0
1 65 0 0 66 0 0
1 66 1 1 74 0 0
0 74 0 1 67 0 0
1 67 0 1 68 0 0
1 68 0 0 75 1 0
0 75 0 0 76 1 0
0 76 0 1 77 1 0
0 77 0 0 78 1 0
0 78 0 1 79 1 0
0 79 0 0 80 1 0
0 80 0 1 81 1 0
0 81 0 0 82 1 0
0 82 0 1 83 1 0
0 83 1 1 84 0 0
0 84 1 0 69 0 0
1 69 1 0 85 0 0
0 85 1 0 70 0 0
1 70 1 0 86 0 0
0 86 1 0 87 1 0
0 87 0 1 71 0 0
1 71 0 0 88 0 0
0 88 0 1 89 0 0
0 89 0 1 72 0 0
1 72 0 0 90 0 0
0 90 0 1 91 0 0
0 91 0 1 73 0 0
1 73 0 0 92 0 0
0 92 0 1 93 0 0
0 93 0 1 74 0 0
1 74 1 1 75 0 0
1 75 0 1 94 0 0
0 94 1 0 95 1 0
0 95 1 1 76 0 0
1 76 0 0 77 0 0
1 77 1 0 78 0 0
1 78 1 0 96 0 0
0 96 1 0 97 0 0
0 97 1 0 98 0 0
0 98 1 0 99 1 0
0 99 0 1 79 0 0
1 79 1 1 80 0 0
1 80 0 0 81 0 0
1 81 1 1 100 0 0
0 100 0 1 82 0 0
1 82 1 1 83 0 0
1 83 1 1 84 0 0
1 84 1 1 101 0 0
0 101 1 1 102 0 0
0 102 1 0 85 1 0
1 85 1 0 86 1 0
1 86 1 0 87 1 0
1 87 1 0 88 1 0
1 88 1 1 89 1 0
1 89 1 0 90 1 0
1 90 1 1 91 1 0
1 91 1 0 92 1 0
1 92 1 1 93 1 0
1 93 1 1 94 0 0
1 94 1 1 95 0 0
1 95 0 1 96 0 0
1 96 0 0 103 0 0
0 103 0 0 97 0 0
1 97 1 0 98 0 0
1 98 1 0 99 0 0
1 99 1 0 104 0 0
0 104 1 0 100 1 1

Made with the help of ASCII_only's program generator.

MathGolf, 27 bytes
'_9*_3{'|_ 9*▌+\}'|_@++]n \

Try it online!
Pretty much the simplest way to do it.

JavaScript, 54 bytes
As with Kevin's Java solution, the boring option ended up being the shortest :\
_=>` _________
${`|         |
`.repeat(3)}|_________|`

Try It Online

Alternative, 59 bytes
_=>` _
| |
| |
| |
|_|`.replace(/../g,x=>x.padEnd(10,x[1]))

Try It Online

52 bytes

05AB1E, 19 bytes
ŽP—S"_| _"SŽNžS.Λ.º

Try it online!
Explanation
ŽP—S                  # push [6,5,2,5] (lengths)
    "_| _"S           # push ["_", "|", " ", "_"] (characters to print)
           ŽNžS       # push [6,0,2,2] (directions)
               .Λ     # draw to canvas without printing
                 .º   # mirror horizontally

Java, 59 Bytes
v-> " _______\n|       |\n|       |\n|       |\n|_______|"

Should this be embedded in a function or something?

Red, 53 bytes
prin[" _________^/"r:"|         |^/"r r"|_________|"]

Try it online!

Brain-Flak, 317 bytes
((((((((()()()()()){}){})()){}{}){}))<>)<>((((((((({}[(((()()()){}()){}){}()])))))))))(<>{}<>)((()()()()()){})(<>()()()){<>(((((((()()()()()){}){})()){}{}){})<>)<> ((((((((((((()()()()){}){}){})))))))))(<>{}<>)((()()()()()){})<>({}[()])}<>(((((()()()()){}){}){}))((((((((((({})){}{}[()])))))))))((((()()()()){}){}){})

Try it online!
Not golfy at all, just a test.

CJam, 31 28 bytes
S'_9*S++'|S9*'|++___4$.e>]N*

Explanation
S'_9*S++'|S9*'|++___4$.e>]N*     e# Whole code
S'_9*S++                         e# Push the string ' _________ '
        '|S9*'|++                e# Push the string '|         |'
                 ___             e# Duplicate it 3 times
                    4$           e# Copy the 4th stack element (' _________ ')
                      .e>        e# Combine the last '|         |' with the
                                 e# ' _________ ' to get '|_________|'
                         ]N*     e# Join with newlines
                                 e# Implicit output

Try it online!

R, 55 bytes
cat(gsub(0,"|         |
"," _________
000|_________|"))

Try it online!

BrainFuck, 129 bytes
+++>++++++++[>++++>>>>+<<<<<-]>[>+++>++++>+<<<-]>->---->>++<.<<.........>>>.<<<<<<[>>>>.>.........<.>>.<<<<<<-]>>>>.<.........>.

This was my first code golf post so it isn't that optimized.

Deadfish~, 226 bytes
iisiisddddc{dd}ddsdddddccccccccc{ddddddddd}ddsicisiiic{{d}dd}iisddddccccccccc{dd}dsiiic{{d}dd}dsicisiiic{{d}dd}iisddddccccccccc{dd}dsiiic{{d}dd}dsicisiiic{{d}dd}iisddddccccccccc{dd}dsiiic{{d}dd}dsicisiiic{ddd}icccccccccd{iii}c

Try it online!

Stax, 18 bytes
é☻x+▓ïqÉ┬i╦↨|╛₧│&▬

Run and debug it

Brainfuck, 93 bytes
--[[<+++>----->->>+++<<<]>]<<.<<-.........<.>>-->>+++[-<<.>.........<.<<.>>>>]<<.<.........>.

Try it online!

PHP, 81 bytes
while($x<9)echo str_pad(str_repeat(($l='_  | | |_|')[$x++],9),11,$l[$x++],2),"
";

Try it online!

///, 43 38 bytes
/~/|         |
//-/_________/ -
~~~|-|

Try it online!
-5 bytes thanks to @PkmnQ

Porting my FEU answer gives 38 bytes

FEU, 44 bytes
a/ ~\n---|~|
m/-/|         |\n/~/_________/g

Try it online!


text:
Prime containment numbers (golf edition)
This is sequence A054261.
The \$n\$th prime containment number is the lowest number which contains the first \$n\$ prime numbers as substrings. For example, the number \$235\$ is the lowest number which contains the first 3 primes as substrings, making it the 3rd prime containment number.
It is trivial to figure out that the first four prime containment numbers are \$2\$, \$23\$, \$235\$ and \$2357\$, but then it gets more interesting. Since the next prime is 11, the next prime containment number is not \$235711\$, but it is \$112357\$ since it's defined as the smallest number with the property.
However, the real challenge comes when you go beyond 11. The next prime containment number is \$113257\$. Note that in this number, the substrings 11 and  13 are overlapping. The number 3 is also overlapping with the number 13.
It is easy to prove that this sequence is increasing, since the next number needs to fulfill all criteria of the number before it, and have one more substring. However, the sequence is not strictly increasing, as is shown by the results for n=10 and n=11.
Input
A single integer n>0 (I suppose you could also have it 0-indexed, then making n>=0)
Output
Either the nth prime containment number, or a list containing the first n prime containment numbers.
The numbers I have found so far are:
 1 =>             2
 2 =>            23
 3 =>           235
 4 =>          2357
 5 =>        112357
 6 =>        113257
 7 =>       1131725
 8 =>     113171925
 9 =>    1131719235
10 =>  113171923295
11 =>  113171923295
12 => 1131719237295

Note that n = 10 and n = 11 are the same number, since \$113171923295\$ is the lowest number which contains all numbers \$[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\$, but it also contains \$31\$.
Since this is marked code golf, get golfing! Brute force solutions are allowed, but your code has to work for any input in theory (meaning that you can't just concatenate the first n primes). Happy golfing!

05AB1E, 8 bytes
∞.ΔIÅpåP

Try it online!
Explanation
           # from
∞          # a list of infinite positive integers
 .Δ        # find the first which satisfies the condition:
       P   # all
   IÅp     # of the first <input> prime numbers
      å    # are contained in the number

Does the P operator create an explicit mapping to check for prime numbers in the number (instead of checking if the number is in the array of primes)? This is a beautiful solution, I doubt you could make any solution using fewer commands.

@maxb P is product. It basically multiplies all the values in a list. The Åp will create a list with the first n amount of primes, where n is the input I in this case. The å will check for each number in this list of primes if they are in the current number of the infinite list, where it will give 1 for truthy and 0 for falsey. So the product basically checks if all are truthy; if all primes are inside the current number. If any are 0, the P results in falsey as well. But if all are 1, the P results in truthy, and the .Δ-loop stops.

@KevinCruijssen I see, thanks for the explanation!

Very nice solution using the new version! I had 8 bytes as well, but in the legacy version of 05AB1E: 1µNIÅpåP. For those who don't know 05AB1E, an explanation for mine as well: 1µ – until the counter variable reaches 1 (it starts at 0, increase N gradually by 1 and perform: NIÅpåP – check if all of the first  primes appear in N and, if so, increment the counter variable automatically. Returns the final value of N.

@Mr.Xcoder: That was actually my first version as well (with X instead of 1, becuase reasons), but I switched to this since I've never had a chance to use ∞ before :)

Jelly, 11 bytes
³ÆN€ẇ€µẠ$1#

Try it online!
Simple brute force. Not completely sure how #'s arity works, so there may be some room for improvement.
How it works
³ÆN€ẇ€µẠ$1#    Main link. Input: Index n.
         1#    Find the first natural number N that satisfies:
³ÆN€             First n primes...
    ẇ€           ...are substrings of N
      µẠ$        All of them are true

"Fixed under filter with condition" may work instead of "condition true for all".

wⱮẠ¥1#ÆN€ saves two bytes.

JavaScript (ES6),  105 ... 92  91 bytes
n=>(k=1,g=(s,d=k++)=>n?k%d--?g(s,d):g(d?s:s+`-!/${n--,k}/.test(n)`):eval(s+';)++n'))`for(;`

Try it online!
How?
We recursively build a concatenation of conditions based on the first \$n\$ primes:
"-!/2/.test(n)-!/3/.test(n)-!/5/.test(n)-!/7/.test(n)-!/11/.test(n)..."

We then look for the smallest \$n\$ such that all conditions evaluate to false:
eval('for(;' + <conditions> + ';)++n')

Commented
n => (                             // main function taking n
  k = 1,                           // k = current prime candidate, initialized to 1
  g = (s,                          // g = recursive function taking the code string s
          d = k++) =>              //     and the divisor d
    n ?                            // if n is not equal to 0:
      k % d-- ?                    //   if d is not a divisor of k:
        g(s, d)                    //     recursive call to test the next divisor
      :                            //   else:
        g(                         //     recursive call with s updated and d undefined:
          d ?                      //       if d is not equal to 0 (i.e. k is composite):
            s                      //         leave s unchanged
          :                        //       else (k is prime):
            s +                    //         decrement n and add to s
            `-!/${n--,k}/.test(n)` //         the next condition based on the prime k
                                   //       the lack of 2nd argument triggers 'd = k++'
        )                          //     end of recursive call
    :                              // else (n = 0):
      eval(s + ';)++n')            //   complete and evaluate the code string
)`for(;`                           // initial call to g with s = [ "for(;" ]

Java 8, 143 bytes
n->{int r=1,f=1,c,i,j,k;for(;f>0;r++)for(i=2,f=c=n;c>0;c-=j>1?1+0*(f-=(r+"").contains(j+"")?1:0):0)for(j=i++,k=2;k<j;)j=j%k++<1?0:j;return~-r;}

Try it online.
NOTES:

Times out above n=7.
Given enough time and resources it only works up to a maximum of n=9 due to the size limit of int (maximum of 2,147,483,647).

With +4 bytes changing the int to a long, the maximum is increased to an output below 9,223,372,036,854,775,807 (about n=20 I think?)
By using java.math.BigInteger the maximum can be increased to any size (in theory), but it will be around +200 bytes at least due to the verbosity of java.math.BigInteger's methods..

Explanation:
n->{                   // Method with integer as both parameter and return-type
  int r=1,             //  Result-integer, starting at 1
      f=1,             //  Flag-integer, starting at 1 as well
      c,               //  Counter-integer, starting uninitialized
      i,j,k;           //  Index integers
  for(;f>0;            //  Loop as long as the flag is not 0 yet
      r++)             //    After every iteration, increase the result by 1
    for(i=2,           //   Reset `i` to 2
        f=c=n;         //   Reset both `f` and `c` to the input `n`
        c>0;           //   Inner loop as long as the counter is not 0 yet
        c-=            //     After every iteration, decrease the counter by:
           j>1?        //      If `j` is a prime:
            1          //       Decrease the counter by 1
            +0*(f-=    //       And also decrease the flag by:
                   (r+"").contains(j+"")?
                       //        If the result `r` contains the prime `j` as substring
                    1  //         Decrease the flag by 1
                   :   //        Else:
                    0) //         Leave the flag the same
           :           //      Else:
            0)         //       Leave the counter the same
      for(j=i++,       //    Set `j` to the current `i`,
                       //    (and increase `i` by 1 afterwards with `i++`)
          k=2;         //    Set `k` to 2 (the first prime)
          k<j;)        //    Inner loop as long as `k` is smaller than `j`
        j=j%k++<1?     //     If `j` is divisible by `k`
           0           //      Set `j` to 0
          :            //     Else:
           j;          //      Leave `j` the same
                       //    (If `j` is unchanged after this inner-most loop,
                       //     it means `j` is a prime)
  return~-r;}          //  Return `r-1` as result

Ruby, 58 bytes
->n,i=1{i+=1until Prime.take(n).all?{|x|/#{x}/=~"#{i}"};i}

Try it online!
Brute-force, works up to 7 on TIO.

Pyth, 14 bytes
Extremely, extremely slow, times out for \$n>5\$ on TIO.
f@I`M.fP_ZQ1y`

Try it online!
f@I`M.fP_ZQ1y`     Full program. Q is the input.
f                  Find the first positive integer that fulfils the condition.
 @I`M.fP_ZQ1y`     Filtering condition, uses T to refer to the number being tested.
     .f   Q1       Starting at 1, find the first Q positive integers (.f...Q1) that
       P_Z         Are prime.
   `M              Convert all of those primes to strings.
  I                Check whether the result is invariant (i.e. doesn't change) when...
 @          y`     Intersecting this list with the powerset of T as a string.

Pyth, 15 bytes
Slightly faster but 1 byte longer.
f.A/L`T`M.fP_ZQ

Try it online!
f.A/L`T`M.fP_ZQ     Full program. Q is the input.
f                   Find the first positive integer that fulfils the condition.
 .A/L`T`M.fP_ZQ     Filtering condition, uses T to refer to the number being tested.
         .f   Q     Starting at 1, find the first Q positive integers (.f...Q) that
           P_Z      Are prime.
       `M           Convert all of those primes to strings.
 .A/L               And make sure that they all (.A) occur in (/L)...
     `T             The string representation of T.

Jelly, 14 bytes
³RÆNṾ€ẇ€ṾȦ
Ç1#

Try it online!

Perl 6, 63 59 bytes
-4 bytes thanks to nwellnhof
{+(1...->\a{!grep {a~~!/$^b/},(grep &is-prime,2..*)[^$_]})}

Try it online!
A brute force solutions that times out on TIO for numbers above 5, but I'm pretty sure it works correctly. Finds the first positive number that contains the first n primes. Here's a solution that doesn't time out for n=6.
Explanation:
{                                                             } # Anonymous code block
 first                                                    2..*  # Find the first number
       ->\a{                                            }       # Where:
            !grep     # None of
                                                   [^$_]  # The first n
                              (grep &is-prime,2..*)       # primes
                  {a~~!/$^b/},   # Are not in the current number

Do you have any way to verify the output for larger numbers, or add an explanation? I'm not fluent in Perl, and I'm certainly not fluent in golf-Perl. I get a timeout on TIO for input 5, so I can't really verify that it doesn't just concatenate primes.

@maxb I've added a link to a solution that generates the primes beforehand rather than repeatedly and an explanation.

Charcoal, 42 bytes
≔¹ηＷ‹ＬυＩθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»≔¹ηＷΦυ¬№ＩηＩκ≦⊕ηＩη

Try it online! Link is to verbose version of code. Explanation:
≔¹ηＷ‹ＬυＩθ«≦⊕η¿¬Φυ¬﹪ηκ⊞υη»

Build up the first n prime numbers by trial division of all the integers by all of the previously found prime numbers.
≔¹ηＷΦυ¬№ＩηＩκ≦⊕η

Loop through all integers until we find one which contains all the primes as substrings.
Ｉη

Cast the result to string and implicitly print.
The program's speed can be doubled at a cost of a byte by replacing the last ≦⊕η with ≦⁺²η but it's still too slow to calculate n>6.

SAS, 149 bytes
data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards;

Input is entered following the cards; statement, like so:
data p;input n;z:i=1;a=0;v+1;do while(a<n);i+1;do j=2 to i while(mod(i,j));end;if j=i then do;a+1;if find(cat(v),cat(i))=0 then goto z;end;end;cards;
1
2
3
4
5
6
7

Outputs a dataset p, with the result v, with an output row for each input value. Should technically work for all the given test-cases (the max integer with full precision in SAS is 9,007,199,254,740,992), but I gave up after letting it think for 5 minutes on n=8.
Explanation:
data p;
input n; /* Read a line of input */

z: /* Jump label (not proud of this) */
    i=1; /* i is the current value which we are checking for primality */
    a=0; /* a is the number of primes we've found so far */
    v+1; /* v is the final output value which we'll look for substrings in */

    do while(a<n); /* Loop until we find the Nth prime */
        i+1;
        do j=2 to i while(mod(i,j));end; /* Prime sieve: If mod(i,j) != 0 for all j = 2 to i, then i is prime. This could be faster by only looping to sqrt(i), but would take more bytes */
        if j=i then do; /* If i is prime (ie, we made it to the end of the prime sieve)... */
            a+1;
            if find(cat(v),cat(i))=0 then goto z; /* If i does not appear as a substring of v, then start all over again with the next v */
        end;
    end;

/* Input values, separated by newlines */
cards;
1
2
3
4
5
6
7

Python 2, 131 bytes
f=lambda n,x=2:x*all(i in`x`for i in g(n,2))or f(n,x+1)
def g(n,x):p=all(x%i for i in range(2,x));return[0]*n and[`x`]*p+g(n-p,x+1)

Try it online!
f is the function.

Python 2, 91 bytes
n=input();l=[]
P=k=1
while~-all(`x`in`k`for x in(l+[l])[:n]):P*=k*k;k+=1;l+=P%k*[k]
print k

Try it online!

If I didn't know that your code generated prime numbers, I would never have been able to figure out that it did. Great job!

Japt, 20 18 bytes
Far from my finest work, I was just happy to get it working after the day I've had. I'm sure I'll end up tapping away at it down the boozer later!
_õ fj ¯U e!øZs}aUÄ

Try it - takes 13 seconds to run for an input of 7, throws a wobbly after that (the updated version craps out at 5 for me, but that might just be my phone).

@Oliver, Hmm ... me too. It was definitely working when I posted it. Just ran a test using F.h() on its own and it seems to be broken; ETH must've changed something.

@Oliver, no, last commit was 2 days ago so nothing's changed since I posted this. Weird!

It's working now! ¯\(ツ)/¯

@Oliver, still not working for me. Weirderer and weirderer!

It has been working for me since I went from my work computer to my home computer. Weird indeed!

@Oliver, a caching issue, maybe? I was on my laptop when I posted this but I've been on my phone since.

Haskell, 102 bytes
import Data.List
f n|x<-[2..n*n]=[a|a<-[2..],all(`isInfixOf`show a).take n$show<$>x\\((*)<$>x<*>x)]!!0

Try it online!
Explanation / Ungolfed
Since we already have Data.List imported we might as well use it: Instead of the good old take n[p|p<-[2..],all((>0).mod p)[2..p-1]] we can use another way of generating all primes we need. Namely, we generate a sufficient amount of composites and use these together with (\\):
[2..n*n] \\ ( (*) <$> [2..n*n] <*> [2..n*n] )

Using n*n suffices because \$\pi(n) < \frac{n^2}{\log(n^2)}\$. The rest is just a simple list comprehension:
[ a | a <- [2..], all (`isInfixOf` show a) . take n $ enoughPrimes ] !!0