%I #10 Feb 05 2022 02:15:24
%S 7,6,5,4,3,2,1,0,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,
%T 44,36,28,20,12,4,59,51,43,35,27,19,11,3,58,50,42,34,26,18,10,2,57,49,
%U 41,33,25,17,9,1,56,48,40,32,24,16,8,0,510,446,382,318,254
%N Write in base k, complement, reverse. Case k = 8.
%H Michael De Vlieger, <a href="/A284807/b284807.txt">Table of n, a(n) for n = 0..10000</a>
%e a(16) = 61 because 16 in base 8 is 20, its complement in base 8 is 57 and the digit reverse is 75 that is 61 in base 10.
%p 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 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,8);
%t With[{k = 8}, Array[FromDigits[Reverse[k - IntegerDigits[#, k] - 1], k] &, 69, 0]] (* _Michael De Vlieger_, Feb 04 2022 *)
%o (Python)
%o def A284807(n): return -int((s:=oct(n)[-1:1:-1]),8)-1+8**len(s) # _Chai Wah Wu_, Feb 04 2022
%Y Cf. A036044, A267193, A284808.
%K nonn,base,easy
%O 0,1
%A _Paolo P. Lava_, Apr 03 2017
%E Offset corrected by _Chai Wah Wu_, Feb 04 2022
|