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.

A076805 Triskaidekaphobic or 13-free primes: primes that do not contain the number 13.

This page as a plain text file.
%I A076805 #44 Feb 16 2025 08:32:47
%S A076805 2,3,5,7,11,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,
%T A076805 101,103,107,109,127,149,151,157,163,167,173,179,181,191,193,197,199,
%U A076805 211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307
%N A076805 Triskaidekaphobic or 13-free primes: primes that do not contain the number 13.
%H A076805 Reinhard Zumkeller, <a href="/A076805/b076805.txt">Table of n, a(n) for n = 1..10000</a>
%H A076805 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Triskaidekaphobia.html">Triskaidekaphobia</a>
%H A076805 Wikipedia, <a href="http://en.wikipedia.org/wiki/Triskaidekaphobia">Triskaidekaphobia</a>
%F A076805 a(n) >> n^1.0044, where the exponent is log(r)/log(10) with r the larger root of x^2 - 10x + 1. [_Charles R Greathouse IV_, Nov 09 2011]
%F A076805 kfreep(n, k) = true if for primes p over the range n and integer k, p mod 10^(floor(log_10(k))+1) <> k for p = p/10 mod 10^(floor(log_10(k))+1) <> k over the range floor(log_10(k))+1. This is a mathematical definition of the recurrence. In practice it is convenient to use string operations. E.g., If Not Instr(Str(p), Str(k)) then true or k is not a substring of p so list p.
%e A076805 The PARI program will mask out a sequence containing k or mask in a sequence containing k. The program is limited to primes < 400000000.
%e A076805 The PARI program will generate the following for input as shown: kprimes(2,100,7,0) = 2 3 5 11 13 19 23 29 31 41 43 53 59 61 83 89; kprimes(2,1000,13,1) = 13 113 131 137 139 313 613; kprimes(300000,4000000,314159,1) = 314159 3314159 5314159
%t A076805 Select[Prime[Range[90]],!MemberQ[Partition[IntegerDigits[#],2,1],{1,3}]&] (* _Harvey P. Dale_, Mar 25 2012 *)
%t A076805 Select[Prime[Range[100]],SequenceCount[IntegerDigits[#],{1,3}]==0&] (* _Harvey P. Dale_, Aug 11 2023 *)
%o A076805 (PARI) /* k primes - kprimes.gp. Primes containing or not containing digit k=1,2,3...9,10,11... PARI does not have a good string manipulation capability. This program circumvents that by using the % modulo and floor operators. Also commented out is a log implementation which is slower than string apps. The program either masks out prime numbers k or masks them in.*/
%o A076805 (PARI) log10(z) = if(z>0,floor(log(z)/log(10))+1,1);\\integer function for log(z) base 10 + 1
%o A076805 { kprimes(n1,n2,k,t) = \\n1,n2=range,k=mask,t=0 mask out t=1 mask in
%o A076805 ct=0; pct=0; forprime(p=n1,n2,x=p; f=0;\\x=temp variable to diminish p
%o A076805 ln = length(Str(p));\\get length of the prime p using strings
%o A076805 lk = length(Str(k));\\get length of mask integer k using strings
%o A076805 ln = log10(p);\\get length of the prime p using logs
%o A076805 lk = log10(k);\\get length of mask integer k using strings
%o A076805 r = 10^lk; \\set the remainder length = length of k
%o A076805 for(j=1,ln-lk+1, \\permute through the digits
%o A076805 d = x % r;\\get lk digits
%o A076805 if(d==k,f=1; break);\\break for loop if match and set flag
%o A076805 x = floor(x/10);\\diminish x for next test for k
%o A076805 ); if(f==t,print1(p" "); ct+=1);\\if no k string of digits,print
%o A076805 ); print(); print(ct); }
%o A076805 (PARI) hasNo13(n)=n=digits(n); for(i=2,#n, if(n[i]==3&&n[i-1]==1, return(0))); 1
%o A076805 select(hasNo13, primes(10^4)) \\ _Charles R Greathouse IV_, Dec 02 2013
%o A076805 (Haskell)
%o A076805 import Data.List (isInfixOf)
%o A076805 a076805 n = a076805_list !! (n-1)
%o A076805 a076805_list = filter (not . ("13" `isInfixOf`) . show) a000040_list
%o A076805 -- _Reinhard Zumkeller_, Nov 09 2011
%o A076805 (PARI) is_A076805(n,t=13)=!until(t>n\=10,t==n%100&&return) \\ _M. F. Hasler_, Dec 02 2013
%Y A076805 A generalization of the examples A038603, A038615 etc. for k = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 by Vasiliy Danilov.
%Y A076805 Cf. A038615 A038603.
%Y A076805 Complement of A166573 with respect to A000040; cf. A011760
%K A076805 nonn,base
%O A076805 1,1
%A A076805 _Cino Hilliard_, Nov 18 2002
%E A076805 Original PARI code restored by _M. F. Hasler_, Dec 02 2013