The OEIS is supported by the many generous donors to the OEIS Foundation. Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 60th year, we have over 367,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”). Other ways to Give
 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A274601 a(n) = 2*3^(s-1) - n, where s is the number of trits of n in balanced ternary form. 2
 1, 4, 3, 2, 13, 12, 11, 10, 9, 8, 7, 6, 5, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS Analogous to a bit, a ternary digit is a trit (trinary digit). Per the definition, n + a(n) = 2*3^(s-1), where s is the number of trits of n and a(n), n and a(n) form a decomposition of 2*3^(s-1). LINKS Lei Zhou, Table of n, a(n) for n = 1..10000 FORMULA a(n) = 2*3^(floor(log(2*n-1)/log(3)). EXAMPLE For n=1 the balanced ternary form of 1 is 1, which has 1 trits. 2*3^(1-1)-1 = 1, so a(1) = 1. For n=2 the balanced ternary form of 2 is 1T, which has 2 trits. 2*3^(2-1)-2 = 4, so a(2) = 4. For n=3 the balanced ternary form of 3 is 10, which has 2 trits. 2*3^(2-1)-3 = 3, so a(2) = 3. ... For n=62 the balanced ternary form of 62 is 1T10T, which has 5 trits. 2^(3^(5-1)-62 = 100, so a(62) = 100. MATHEMATICA Table[2*3^(Floor[Log[3, 2*n - 1]]) - n, {n, 1, 62}] PROG (Python) from sympy import log, floor def a(n): return 2*3**(floor(log(2*n - 1, 3))) - n print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 10 2017 CROSSREFS Cf. A117966, A134021, A140267, A134028. Sequence in context: A182142 A033881 A099406 * A202696 A319541 A239020 Adjacent sequences: A274598 A274599 A274600 * A274602 A274603 A274604 KEYWORD nonn,base,easy AUTHOR Lei Zhou, Nov 10 2016 STATUS approved

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

Last modified December 9 13:48 EST 2023. Contains 367691 sequences. (Running on oeis4.)