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.

A089981 Primes whose decimal representation also represents a prime in base 3.

This page as a plain text file.
%I A089981 #34 Aug 15 2022 13:35:16
%S A089981 2,2111,2221,10211,12011,12211,20201,21011,21101,21211,22111,101021,
%T A089981 101111,102101,102121,110221,111121,111211,120011,120121,121001,
%U A089981 121021,122011,201101,202001,202021,210011,210101,1000211,1010201,1012201
%N A089981 Primes whose decimal representation also represents a prime in base 3.
%C A089981 See A065721 for the primes given by these terms considered as numbers written in base 3, i.e., the sequence with the definition "working in the opposite sense". - _M. F. Hasler_, Jan 05 2014
%H A089981 Charles R Greathouse IV, <a href="/A089981/b089981.txt">Table of n, a(n) for n = 1..10000</a>
%H A089981 Alejandro J. Becerra Jr., <a href="https://github.com/ajbecerr/OEIS/blob/main/A089971%2C%20A089981%2C%20A090707-A090710%2C%20A235394-A235395.ipynb">Python code for computing terms of A089971, A089981, A090707-A090710, A235394-A235395</a>.
%e A089981 2111 is a prime and its decimal representation is also a valid base-3 representation (because all digits are < 3), and 2111[3] = 67[10] is again a prime. Therefore 2111 is in the sequence.
%t A089981 Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 3], PrimeQ] (* _Robert G. Wilson v_, Jan 05 2014 *)
%t A089981 FromDigits/@Select[Tuples[{0,1,2},7],AllTrue[{FromDigits[#],FromDigits[ #,3]},PrimeQ]&] (* _Harvey P. Dale_, Aug 15 2022 *)
%o A089981 (PARI) is_A089981(p)=vecmax(d=digits(p))<3&&isprime(vector(#d,i,3^(#d-i))*d~)&&isprime(p) \\ "d" is implicitly declared local. Putting isprime(p) to the end improves performance when the function is applied to primes only, as below, or to very large numbers. - _M. F. Hasler_, Jan 05 2014
%o A089981 (PARI) forprime(p=2,1e6,is_A089981(p)&&print1(p",")) \\ - _M. F. Hasler_, Jan 05 2014
%o A089981 (PARI) fixBase(n, oldBase, newBase)=my(d=digits(n, oldBase), t=newBase-1); for(i=1, #d, if(d[i]>t, for(j=i, #d, d[j]=t); break)); fromdigits(d, newBase)
%o A089981 list(lim)=my(v=List(), t); forprime(p=2, fixBase(lim\1, 10, 3), if(isprime(t=fromdigits(digits(p, 3), 10)), listput(v, t))); Vec(v) \\ _Charles R Greathouse IV_, Nov 07 2016
%Y A089981 Cf. A031974, A089971, A090707, A090708, A090709, A090710, A235394, A235395, A000040 and further references therein.
%K A089981 base,nonn
%O A089981 1,1
%A A089981 _Cino Hilliard_, Jan 18 2004
%E A089981 Definition and example reworded, offset corrected and cross-references added by _M. F. Hasler_, Jan 05 2014