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.

A309574 n-th prime minus its ternary (base 3) reversal.

This page as a plain text file.
%I A309574 #50 Aug 21 2019 03:16:09
%S A309574 0,2,-2,2,-8,0,-8,8,0,-26,-6,6,-26,-6,-14,-26,-6,14,26,-6,38,26,-80,
%T A309574 -128,-48,-80,-24,-128,24,-80,24,-80,-32,24,-56,0,24,80,-24,0,-48,80,
%U A309574 24,80,-24,104,80,80,48,104,0,24,80,-398,-338,-278,-434,18,-138
%N A309574 n-th prime minus its ternary (base 3) reversal.
%C A309574 a(n) = 0 if and only if n is palindromic in base 3 - if and only if A000040(n) is in A014190.
%C A309574 As it occurs in its binary cousin, we observe that a scatter plot of this sequence shows parallelograms.
%C A309574 All terms are even. - _Alois P. Heinz_, Aug 08 2019
%H A309574 Robert Israel, <a href="/A309574/b309574.txt">Table of n, a(n) for n = 1..10000</a>
%H A309574 Samuel M. A. Luque, <a href="http://tiny.cc/3r2xaz">C++ Program (.cpp file) to generate this sequence in whichever m-th base you choose.</a>
%H A309574 Samuel M. A. Luque, <a href="https://imgur.com/a/bLj98Nk">Scatter plot of a(n) up to n = 8132 (primes up to 50 000).</a>
%F A309574 a(n) = A000040(n) - A030102(A000040(n)).
%F A309574 a(n) = A055947(A000040(n)).
%p A309574 a:= n-> (p-> p-(l->add(l[-i]*3^(i-1), i=1..nops(l))
%p A309574         )(convert(p, base, 3)))(ithprime(n)):
%p A309574 seq(a(n), n=1..61);  # _Alois P. Heinz_, Aug 08 2019
%t A309574 (# - IntegerReverse[#,3]) &@ Prime@ Range@ 60 (* _Giovanni Resta_, Aug 09 2019 *)
%o A309574 (Python)
%o A309574 from sympy import primerange
%o A309574 def rev(n, b):
%o A309574     m = 0
%o A309574     while n > 0:
%o A309574         m, n = m*b+n%b, n//b
%o A309574     return m
%o A309574 n, aa = 1, 1
%o A309574 while n <20:
%o A309574     if aa in primerange(1,200):
%o A309574         print(n, aa-rev(aa, 3))
%o A309574         n = n+1
%o A309574     aa = aa+1 # _A.H.M. Smeets_, Aug 09 2019
%o A309574 (PARI) a(n) = my(p=prime(n)); p - fromdigits(Vecrev(digits(p, 3)), 3); \\ _Michel Marcus_, Aug 09 2019
%Y A309574 Cf. A000040, A014190, A030102, A055947, A265326.
%K A309574 sign,base,look
%O A309574 1,2
%A A309574 _Samuel M. A. Luque Astorga_, Aug 08 2019