login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Prime numbers containing the string 13.
16

%I #30 May 03 2015 03:38:31

%S 13,113,131,137,139,313,613,1013,1213,1301,1303,1307,1319,1321,1327,

%T 1361,1367,1373,1381,1399,1613,1913,2113,2131,2137,2213,2713,3137,

%U 3313,3413,3613,4013,4133,4139,4513,4813,5113,5413,5813,6113,6131,6133,7013,7213,8513

%N Prime numbers containing the string 13.

%H Reinhard Zumkeller, <a href="/A166573/b166573.txt">Table of n, a(n) for n = 1..10000</a>

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

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Triskaidekaphobia">Triskaidekaphobia</a>

%F a(n) ~ n log n. - _Charles R Greathouse IV_, Nov 09 2011

%t p13Q[n_] := Module[{idn = IntegerDigits[n]}, MemberQ[Partition[idn, 2, 1], {1, 3}]]; Select[Prime[Range[1000]], p13Q] (* _Vincenzo Librandi_, Sep 14 2012 *)

%t Select[Prime[Range[1500]], ! StringFreeQ[ToString[#], "13"] &] (* _Vincenzo Librandi_, May 03 2015 *)

%o (Haskell)

%o import Data.List (isInfixOf)

%o a166573 n = a166573_list !! (n-1)

%o a166573_list = filter (("13" `isInfixOf`) . show) a000040_list

%o -- _Reinhard Zumkeller_, Nov 09 2011

%o (PARI) contains(n,k)=my(N=digits(n),K=digits(k)); for(i=0,#N-#K, for(j=1,#K,if(N[i+j]!=K[j],next(2))); return(1)); 0

%o is(n)=isprime(n) && contains(n,13) \\ _Charles R Greathouse IV_, Jun 20 2014

%Y Complement of A076805 with respect to A000040.

%Y Cf. A166571, A166572, A166579, A166580, A166581, A166582.

%K nonn,base

%O 1,1

%A _Vincenzo Librandi_, Nov 01 2009

%E Corrected (313 inserted) by _R. J. Mathar_, Nov 30 2009