OFFSET
1,1
COMMENTS
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
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Alejandro J. Becerra Jr., Python code for computing terms of A089971, A089981, A090707-A090710, A235394-A235395.
EXAMPLE
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.
MATHEMATICA
Select[ FromDigits@# & /@ IntegerDigits[ Prime@ Range@ 270, 3], PrimeQ] (* Robert G. Wilson v, Jan 05 2014 *)
FromDigits/@Select[Tuples[{0, 1, 2}, 7], AllTrue[{FromDigits[#], FromDigits[ #, 3]}, PrimeQ]&] (* Harvey P. Dale, Aug 15 2022 *)
PROG
(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
(PARI) forprime(p=2, 1e6, is_A089981(p)&&print1(p", ")) \\ - M. F. Hasler, Jan 05 2014
(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)
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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Cino Hilliard, Jan 18 2004
EXTENSIONS
Definition and example reworded, offset corrected and cross-references added by M. F. Hasler, Jan 05 2014
STATUS
approved