login
A397695
Residue class of the decimal digits of n taken mod 3, with 0 represented by 3, and in nondecreasing order.
0
3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 13, 11, 12, 13, 11, 12, 13, 11, 12, 13, 23, 12, 22, 23, 12, 22, 23, 12, 22, 23, 33, 13, 23, 33, 13, 23, 33, 13, 23, 33, 13, 11, 12, 13, 11, 12, 13, 11, 12, 13, 23, 12, 22, 23, 12, 22, 23, 12, 22, 23, 33, 13, 23, 33, 13, 23, 33, 13
OFFSET
0,1
COMMENTS
Also, a(n) is the digits of A397694(n) sorted in nondecreasing order.
LINKS
EXAMPLE
a(57) = 12 since 5 mod 3 = 2 and 7 mod 3 = 1, and 21 sorted in nondecreasing order is 12.
a(68) = 23 since 6 mod 3 = 0 (which is encoded as 3) and 8 mod 3 = 2, and 32 sorted in nondecreasing order is 23.
MATHEMATICA
A397695[n_] := FromDigits[Sort[Mod[IntegerDigits[n], 3] /. 0 -> 3]];
Array[A397695, 100, 0] (* Paolo Xausa, Jul 05 2026 *)
PROG
(Python)
def a(n): return int("".join(sorted(map(str, [(r:=di%3)+3*int(r==0) for di in list(map(int, str(n)))]))))
print([a(n) for n in range(68)])
CROSSREFS
KEYWORD
nonn,base,easy,new
AUTHOR
Michael S. Branicky, Jul 05 2026
STATUS
approved