cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A381606 a(n) is the smallest prime number greater than n that contains n as a substring of its digits.

This page as a plain text file.
%I A381606 #65 Mar 18 2025 16:15:07
%S A381606 101,11,23,13,41,53,61,17,83,19,101,113,127,113,149,151,163,173,181,
%T A381606 191,1201,211,223,223,241,251,263,127,281,229,307,131,1321,233,347,
%U A381606 353,367,137,383,139,401,241,421,431,443,457,461,347,487,149,503,151,521,353,541
%N A381606 a(n) is the smallest prime number greater than n that contains n as a substring of its digits.
%H A381606 Joost de Winter, <a href="/A381606/b381606.txt">Table of n, a(n) for n = 0..9000</a>
%H A381606 David A. Corneth, <a href="/A381606/a381606.gp.txt">PARI program</a>
%H A381606 Joost de Winter, <a href="/A381606/a381606.m.txt">MATLAB function</a>
%F A381606 a(n) > 2n. For large enough n, a(n) < n^5 by the strongest known version of Linnik's theorem. - _Charles R Greathouse IV_, Mar 01 2025
%e A381606 The first prime number greater than 0 that contains "0" is 101, so a(0) = 101.
%e A381606 The first prime number greater than 1 that contains "1" is 11, so a(1) = 11.
%e A381606 The first prime number greater than 2 that contains "2" is 23, so a(2) = 23.
%p A381606 f:= proc(n) local m,d,d1,x,y,L;
%p A381606   m:= length(n);
%p A381606   for d from 1 do
%p A381606     L:= sort([seq(10^d * n + x, x = 1 .. 10^d-1, 2),
%p A381606              seq(n+10^m*x, x=10^(d-1) .. 10^d-1),
%p A381606              seq(seq(seq(10^d1*n + x + 10^(m+d1)*y, x=1 .. 10^d1-1,2),y=10^(d-d1-1) .. 10^(d-d1)-1),d1=1..d-1)]);
%p A381606     for x in L do if isprime(x) then return x fi od
%p A381606   od
%p A381606 end proc:
%p A381606 f(0):= 101:
%p A381606 map(f, [$0..100]); # _Robert Israel_, Mar 02 2025
%t A381606 a[n_] := Module[{p = NextPrime[n + 1], s = ToString[n]}, While[! StringContainsQ[ToString[p], s], p = NextPrime[p]]; p]; Array[a, 100, 0] (* _Amiram Eldar_, Mar 03 2025 *)
%o A381606 (MATLAB) \\ See De Winter link
%o A381606 (PARI) a(n) = my(p=nextprime(n+1), s=Str(n)); while (#strsplit(Str(p), s) < 2, p = nextprime(p+1)); p; \\ _Michel Marcus_, Mar 01 2025
%o A381606 (PARI) \\ See Corneth link
%Y A381606 Cf. A062584, A354114, A381099, A064735.
%K A381606 nonn,base
%O A381606 0,1
%A A381606 _Joost de Winter_, Mar 01 2025