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


Python script to generate the first 1000 answers
Perl 6, 31 bytes

{$^a;first {$a**$_~~/$a/},2..*}


Try it online!