login
a(n) is the smallest k > n such that prime(k)# contains the digits of prime(n)# as a substring.
1

%I #33 Dec 23 2025 04:42:44

%S 4,4,8,6,13,74,295,842,2848,9267,73858,481646

%N a(n) is the smallest k > n such that prime(k)# contains the digits of prime(n)# as a substring.

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Primorial.html">Primorial</a>.

%e a(4) = 13 since prime(4)# = 210 and prime(13)# = 304250263527210.

%t primorial[n_] := Product[Prime[j], {j, n}]; Table[k = n + 1; While[Length@SequencePosition[IntegerDigits[primorial[k]], IntegerDigits[primorial[n]]] == 0, k++]; k, {n, 0, 9}]

%o (PARI) P(n) = vecprod(primes(n));

%o a(n) = my(k=n+1, sp=Str(P(n))); while (#strsplit(Str(P(k)), sp) < 2, k++); k; \\ _Michel Marcus_, Dec 18 2025

%o (Python)

%o from itertools import count

%o from gmpy2 import mpz, digits, next_prime

%o from sympy import primorial, prime

%o def A390378(n):

%o if n == 0: return 4

%o m = mpz(primorial(n))

%o p = prime(n+1)

%o s = digits(m)

%o for k in count(n+1):

%o m *= p

%o if s in digits(m):

%o return k

%o p = next_prime(p) # _Chai Wah Wu_, Dec 22 2025

%Y Cf. A002110, A086654, A354114.

%K nonn,base,hard,more

%O 0,1

%A _Ilya Gutkovskiy_, Dec 16 2025

%E a(10)-a(11) from _Michael S. Branicky_, Dec 18 2025