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.

A018847 Strobogrammatic primes: the same upside down (calculator-style numerals).

This page as a plain text file.
%I A018847 #23 Apr 09 2024 16:38:38
%S A018847 2,5,11,101,151,181,619,659,6229,10501,12821,15551,16091,18181,19861,
%T A018847 60209,60509,61519,61819,62129,116911,119611,160091,169691,191161,
%U A018847 196961,605509,620029,625529,626929,650059,655559,656959,682289,686989,688889
%N A018847 Strobogrammatic primes: the same upside down (calculator-style numerals).
%C A018847 This is the subsequence of primes in A018846. - _M. F. Hasler_, May 05 2012
%H A018847 Chai Wah Wu, <a href="/A018847/b018847.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..648 from M. F. Hasler)
%t A018847 lst = {}; fQ[n_] := Block[{allset = {0, 1, 2, 5, 6, 8, 9}, id = IntegerDigits@n}, Union@ Join[id, allset] == allset && Reverse[id /. {6 -> 9, 9 -> 6}] == id]; Do[ If[ PrimeQ@n && fQ@n, AppendTo[lst, n]], {n, 700000}]; lst (* _Robert G. Wilson v_, Feb 27 2007 *)
%o A018847 (PARI) {write("/tmp/b018847.txt","1 2\n2 5"); c=2; s2=[0,1,2,5,6,8,9]; s=[0,1,2,5,8]; s1=[0,1,2,5,9,8,6]; for(n=2,9, p1=vector( (n+1)\2, i, 10^(i-1)); p2=vector( (n+1)\2, i, 10^(n-i)); forvec( v=vector((n+1)\2,i,if( i>1, [ 1,if( i>n\2, #s, #s1)], [2,5])), v[1]==3 & v[1]=5; ispseudoprime( t=sum(i=1,n\2,p1[i]*s1[v[i]]+p2[i]*s2[v[i]] ) +if(n%2,p1[#p1]*s[v[#v]] )) & /* print1(t",") */ write("/tmp/b018847.txt",c++" "t)))} \\ - _M. F. Hasler_, Apr 26 2012
%o A018847 (PARI) is_A018847(n,t=Vec("012..59.86"))={ isprime(n) & apply(x->t[eval(x)+1], n=Vec(Str(n)))==vecextract(n, "-1..1") } \\ - _M. F. Hasler_, May 05 2012
%o A018847 (Python)
%o A018847 from itertools import count, islice
%o A018847 from sympy import isprime
%o A018847 def A018847_gen(): # generator of terms
%o A018847     r, t, u = ''.maketrans('69','96'), set('0125689'), {0,1,2,5,8}
%o A018847     for x in count(1):
%o A018847         for y in range(10**(x-1),10**x):
%o A018847             if y%10 in u:
%o A018847                 s = str(y)
%o A018847                 if set(s) <= t and isprime(m:=int(s+s[-2::-1].translate(r))):
%o A018847                     yield m
%o A018847         for y in range(10**(x-1),10**x):
%o A018847             s = str(y)
%o A018847             if set(s) <= t and isprime(m:=int(s+s[::-1].translate(r))):
%o A018847                 yield m
%o A018847 A018847_list = list(islice(A018847_gen(),20)) # _Chai Wah Wu_, Apr 09 2024
%Y A018847 Cf. A007597 (more restrictive version not allowing digits 2 or 5).
%K A018847 nonn,base
%O A018847 1,1
%A A018847 _David W. Wilson_