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.

A134027 Nonnegative numbers that are palindromes in balanced ternary representation.

This page as a plain text file.
%I A134027 #17 Feb 16 2025 08:33:06
%S A134027 0,1,4,7,10,13,16,28,40,43,52,61,73,82,91,103,112,121,124,160,196,208,
%T A134027 244,280,292,328,364,367,394,421,457,484,511,547,574,601,613,640,667,
%U A134027 703,730,757,793,820,847,859,886,913,949,976,1003,1039,1066,1093,1096
%N A134027 Nonnegative numbers that are palindromes in balanced ternary representation.
%C A134027 A134028(a(n)) = a(n).
%D A134027 D. E. Knuth, The Art of Computer Programming, Addison-Wesley, Reading, MA, Vol 2, pp 173-175.
%H A134027 Lei Zhou, <a href="/A134027/b134027.txt">Table of n, a(n) for n = 1..10000</a>
%H A134027 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PalindromicNumber.html">Palindromic Number</a>
%H A134027 Wikipedia, <a href="http://en.wikipedia.org/wiki/Balanced_ternary">Balanced Ternary</a>
%e A134027 a(10) = 43 = 1*3^4 - 1*3^3 - 1*3^2 - 1*3^1 + 1*3^0 == '+---+';
%e A134027 a(11) = 52 = 1*3^4 - 1*3^3 + 0*3^2 - 1*3^1 + 1*3^0 == '+-0-+';
%e A134027 a(12) = 61 = 1*3^4 - 1*3^3 + 1*3^2 - 1*3^1 + 1*3^0 == '+-+-+';
%e A134027 a(13) = 73 = 1*3^4 + 0*3^3 - 1*3^2 + 0*3^1 + 1*3^0 == '+0-0+'.
%t A134027 balTernDigits[0] := {0}; balTernDigits[n_ /; n > 0] := Module[{unParsed = n, currRem, currExp = 1, digitList = {}, nextDigit}, While[unParsed > 0, If[unParsed == 3^(currExp - 1), digitList = Append[digitList, 1]; unParsed = 0, currRem = Mod[unParsed, 3^currExp]/3^(currExp - 1); nextDigit = Switch[ currRem, 0, 0, 2, -1, 1, 1]; digitList = Append[ digitList, nextDigit]; unParsed = unParsed - nextDigit*3^(currExp - 1)]; currExp++]; digitList = Reverse[digitList]; Return[ digitList]]; balTernDigits[n_ /; n < 0] := (-1) balTernDigits[ Abs[ n]]; palQ[n_] := n == Reverse@ n; Select[ Range@ 1300, palQ@ balTernDigits@# &] (* _Robert G. Wilson v_, Jun 17 2014 *)
%Y A134027 Cf. A014190.
%K A134027 nonn,base
%O A134027 1,3
%A A134027 _Reinhard Zumkeller_, Oct 19 2007