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.

A323782 Prime numbers such that the reverse of the balanced ternary representation is a prime or a negated prime.

This page as a plain text file.
%I A323782 #36 Dec 19 2024 11:48:12
%S A323782 2,5,7,11,13,17,29,31,37,43,53,59,61,71,73,83,89,101,103,137,139,149,
%T A323782 163,173,179,181,193,199,223,233,241,263,269,277,311,313,331,347,353,
%U A323782 367,373,379,383,389,401,421,443,449,457,467,479,487,499,509,541
%N A323782 Prime numbers such that the reverse of the balanced ternary representation is a prime or a negated prime.
%C A323782 The "warp" operation is an inverse map connecting this sequence and A323783.
%H A323782 Github, <a href="https://github.com/sneakyweasel/WarpPrimes">Python code repository</a>
%H A323782 Rosetta Code, <a href="http://www.rosettacode.org/wiki/Balanced_ternary">Balanced Ternary Code</a>
%H A323782 Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced Ternary</a>
%e A323782 29 is a term:
%e A323782 29 is +0+- in balanced ternary notation
%e A323782 +0+- reversed is -+0+
%e A323782 -+0+ is -17 in balanced ternary notation
%e A323782 the absolute value of -17 is 17.
%e A323782 17 is prime
%e A323782 Therefore 29 is "warped" to -17.
%e A323782 This operation is reversible: -17 "warps" to 29.
%o A323782 (Python) # See links.
%o A323782 (PARI) d3(n) = if ((n%3)==2, n\3+1, n\3);
%o A323782 m3(n) = if ((n%3)==2, -1, n % 3);
%o A323782 t(n) = if (n==0, [0], if (abs(n) == 1, [n], concat(m3(n), t(d3(n)))));
%o A323782 f(n) = subst(Pol(Vec(t(n))), x, 3);
%o A323782 isok(n) = isprime(n) && isprime(abs(f(n))); \\ _Michel Marcus_, Jan 29 2019
%o A323782 (PARI) is(n) = {if(!isprime(n), return(0)); my(d = digits(n, 3)); forstep(i = #d, 2, -1, if(d[i] >= 2, d[i] -= 3; d[i-1]++)); if(d[1] >= 2, d[1]-=3; d = concat(1, d)); isprime(abs(fromdigits(Vecrev(d), 3)))} \\ _David A. Corneth_, Feb 14 2019
%Y A323782 Cf. A000040, A134028.
%Y A323782 Supersequence of A224502.
%Y A323782 Corresponding primes and -primes are in sequence A323783.
%Y A323782 Primes that don't "warp" to a prime numbers are in sequence A323784.
%K A323782 nonn,base
%O A323782 1,1
%A A323782 _Philippe Cochin_, Jan 27 2019