login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A323782 Prime numbers such that the reverse of the balanced ternary representation is a prime or a negated prime. 2

%I

%S 2,5,7,11,13,17,29,31,37,43,53,59,61,71,73,83,89,101,103,137,139,149,

%T 163,173,179,181,193,199,223,233,241,263,269,277,311,313,331,347,353,

%U 367,373,379,383,389,401,421,443,449,457,467,479,487,499,509,541

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

%C The "warp" operation is an inverse map connecting this sequence and A323783.

%H Github, <a href="https://github.com/sneakyweasel/WarpPrimes">Python code repository</a>

%H Rosetta Code, <a href="http://www.rosettacode.org/wiki/Balanced_ternary">Balanced Ternary Code</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced Ternary</a>

%e 29 is a term:

%e 29 is +0+- in balanced ternary notation

%e +0+- reversed is -+0+

%e -+0+ is -17 in balanced ternary notation

%e the absolute value of -17 is 17.

%e 17 is prime

%e Therefore 29 is "warped" to -17.

%e This operation is reversible: -17 "warps" to 29.

%o (Python) See links.

%o (PARI) d3(n) = if ((n%3)==2, n\3+1, n\3);

%o m3(n) = if ((n%3)==2, -1, n % 3);

%o t(n) = if (n==0, [0], if (abs(n) == 1, [n], concat(m3(n), t(d3(n)))));

%o f(n) = subst(Pol(Vec(t(n))), x, 3);

%o isok(n) = isprime(n) && isprime(abs(f(n))); \\ _Michel Marcus_, Jan 29 2019

%o (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 Cf. A000040, A134028.

%Y Supersequence of A224502.

%Y Corresponding primes and -primes are in sequence A323783.

%Y Primes that don't "warp" to a prime numbers are in sequence A323784.

%K nonn,base

%O 1,1

%A _Philippe Cochin_, Jan 27 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 22 14:44 EDT 2019. Contains 328318 sequences. (Running on oeis4.)