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.

A284797 Write in base k, complement, reverse. Case k = 3.

This page as a plain text file.
%I A284797 #15 Feb 05 2022 02:15:15
%S A284797 2,1,0,7,4,1,6,3,0,25,16,7,22,13,4,19,10,1,24,15,6,21,12,3,18,9,0,79,
%T A284797 52,25,70,43,16,61,34,7,76,49,22,67,40,13,58,31,4,73,46,19,64,37,10,
%U A284797 55,28,1,78,51,24,69,42,15,60,33,6,75,48,21,66,39,12,57,30
%N A284797 Write in base k, complement, reverse. Case k = 3.
%H A284797 Harvey P. Dale, <a href="/A284797/b284797.txt">Table of n, a(n) for n = 0..1000</a>
%e A284797 a(9) = 25 because 9 in base 3 is 100, its complement in base 3 is 122 and the digit reverse is 221 that is 25 in base 10.
%p A284797 P:=proc(q,h) local a,b,k,n; print(h-1); for n from 1 to q do a:=convert(n,base,h); b:=0;
%p A284797 for k from 1 to nops(a) do a[k]:=h-1-a[k]; b:=h*b+a[k]; od; print(b); od; end: P(10^2,3);
%t A284797 Table[FromDigits[Reverse[2-IntegerDigits[n,3]],3],{n,0,70}] (* _Harvey P. Dale_, Sep 08 2019 *)
%o A284797 (Python)
%o A284797 from gmpy2 import digits
%o A284797 def A284797(n): return -int((s:=digits(n,3)[::-1]),3)-1+3**len(s) # _Chai Wah Wu_, Feb 04 2022
%Y A284797 Cf. A036044, A267193, A284798.
%K A284797 nonn,base,easy
%O A284797 0,1
%A A284797 _Paolo P. Lava_, Apr 03 2017