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.

A174659 Numbers whose balanced ternary representation has more positive trits than negative trits.

This page as a plain text file.
%I A174659 #19 Jan 07 2025 08:33:30
%S A174659 1,3,4,7,9,10,11,12,13,19,21,22,25,27,28,29,30,31,33,34,35,36,37,38,
%T A174659 39,40,49,55,57,58,61,63,64,65,66,67,73,75,76,79,81,82,83,84,85,87,88,
%U A174659 89,90,91,92,93,94,97,99,100,101,102,103,105,106,107,108,109,110,111,112
%N A174659 Numbers whose balanced ternary representation has more positive trits than negative trits.
%C A174659 Numbers for which the sum of trits is positive.
%H A174659 Daniel Forgues, <a href="/A174659/b174659.txt">Table of n, a(n) for n=1..53007</a>
%F A174659 a(n) < 2n. - _Yifan Xie_, Dec 24 2024
%t A174659 (* First run the program for A065363 to define balTernDigits *) Select[Range[210], Count[balTernDigits[#], -1] < Count[balTernDigits[#], 1] &] (* _Alonso del Arte_, Feb 26 2011 *)
%o A174659 (Python)
%o A174659 def a(n):
%o A174659     s=0
%o A174659     x=0
%o A174659     while n>0:
%o A174659         x=n%3
%o A174659         n//=3
%o A174659         if x==2:
%o A174659             x=-1
%o A174659             n+=1
%o A174659         s+=x
%o A174659     return s
%o A174659 print([n for n in range(301) if a(n)>0]) # _Indranil Ghosh_, Jun 07 2017
%Y A174659 Cf. A174657, A174658, A065363, A140267.
%K A174659 base,nonn
%O A174659 1,2
%A A174659 _Daniel Forgues_, Mar 26 2010