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.

A171960 Values of the 2-complement of n in ternary representation.

This page as a plain text file.
%I A171960 #14 Apr 03 2025 01:34:47
%S A171960 2,1,0,5,4,3,2,1,0,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,53,52,
%T A171960 51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,
%U A171960 28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2
%N A171960 Values of the 2-complement of n in ternary representation.
%H A171960 Reinhard Zumkeller, <a href="/A171960/b171960.txt">Table of n, a(n) for n = 0..10000</a>
%F A171960 a(n) = if n < 3 then 2 - n else 3*a(floor(n/3)) + 2 - n mod 3.
%F A171960 a(A134026(n)) < A134026(n).
%F A171960 a(A003462(n)) = A003462(n).
%F A171960 a(A134025(n)) >= A134025(n).
%t A171960 a[n_] := 3^(1 + Floor[Log[3, n]]) - n - 1; a[0] = 2; Array[a, 100] (* _Amiram Eldar_, Apr 03 2025 *)
%o A171960 (PARI) a(n) = 3^(if(n,logint(n,3))+1) - 1 - n; \\ _Kevin Ryde_, Jul 16 2020
%Y A171960 Cf. A003462, A007089, A035327, A061601, A134025, A134026.
%K A171960 nonn,base
%O A171960 0,1
%A A171960 _Reinhard Zumkeller_, Jan 20 2010