%I #6 Feb 24 2016 13:03:02
%S 1,0,0,2,2,1,1,0,2,1,1,2,0,0,0,0,1,1,1,2,2,0,0,0,0,0,0,2,0,0,0,0,1,1,
%T 1,1,1,2,1,0,2,0,2,2,0,0,1,0,0,0,0,1,2,0,2,1,0,2,1,2,1,1,1,2,2,2,0,1,
%U 1,1,1,2,0,2,2,0,2,1,1,1,0,1,0,2,1,0
%N Ternary version of A257341: take the proper fractions in lowest terms in ascending order by denominators and within each denominator in ascending order by numerators. a(n) is the n-th ternary digit of the n-th fraction.
%t FractionList[n_] := Module[
%t {i, j, A},
%t A = Union[Flatten[Table[j/i, {i, 1, n}, {j, 1, i}]]];
%t Sort[A,
%t Denominator[#1] <
%t Denominator[#2] || (Denominator[#1] ==
%t Denominator[#2] && #1 < #2) &]
%t ];
%t DiagDigits[n_, b_] := Module[
%t {A, B, d},
%t A = Drop[FractionList[n], 1];
%t d = Table[RealDigits[A[[i]], b, n, -1][[1, i]], {i, 1, n}]
%t ];
%t DiagDigits[86, 3]
%Y Cf. A257341, A020652, A038567.
%K nonn,cons
%O 1,4
%A _Peter Karpov_, Feb 23 2016
|