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.

A319651 Largest number having in its ternary representation the same number of 0's, 1's and 2's as n.

This page as a plain text file.
%I A319651 #25 Aug 07 2024 10:35:05
%S A319651 0,1,2,3,4,7,6,7,8,9,12,21,12,13,22,21,22,25,18,21,24,21,22,25,24,25,
%T A319651 26,27,36,63,36,39,66,63,66,75,36,39,66,39,40,67,66,67,76,63,66,75,66,
%U A319651 67,76,75,76,79,54,63,72,63,66,75,72,75,78,63,66,75,66,67,76,75,76
%N A319651 Largest number having in its ternary representation the same number of 0's, 1's and 2's as n.
%H A319651 Seiichi Manyama, <a href="/A319651/b319651.txt">Table of n, a(n) for n = 0..6560</a>
%F A319651 n <= a(n) < 3n. - _Charles R Greathouse IV_, Aug 07 2024
%t A319651 Table[FromDigits[ReverseSort[IntegerDigits[n, 3]], 3], {n, 0, 100}] (* _Paolo Xausa_, Aug 07 2024 *)
%o A319651 (Ruby)
%o A319651 def A(k, n)
%o A319651   (0..n).map{|i| i.to_s(k).split('').sort.reverse.join.to_i(k)}
%o A319651 end
%o A319651 p A(3, 100)
%o A319651 (PARI) a(n) = fromdigits(vecsort(digits(n, 3),,4), 3); \\ _Michel Marcus_, Sep 25 2018
%o A319651 (Python)
%o A319651 from gmpy2 import digits
%o A319651 def A319651(n):
%o A319651     return int(''.join(sorted(digits(n,3),reverse=True)),3) # _Chai Wah Wu_, Sep 26 2018
%Y A319651 Base b: A073138 (b=2), this sequence (b=3), A319720 (b=4), A319722 (b=5), A319723 (b=6), A319724 (b=7), this sequence (b=8), A319726 (b=9), A004186 (b=10).
%Y A319651 Cf. A038574.
%K A319651 nonn,base,look,easy
%O A319651 0,3
%A A319651 _Seiichi Manyama_, Sep 25 2018