OFFSET
0,3
COMMENTS
Look at the largest digit of n. If it is even, remove all odd digits of n. If it is odd, remove all even digits. The remaining digits form the term.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
FORMULA
a(k) = k for k in A059708.
EXAMPLE
a(1121) = 2 since the largest digit is 2, and we delete the odd 1 digits to obtain 2.
a(3674) = 37 since the largest digit is 7, and we delete the even digits 6 and 4 to obtain 37.
a(5060) = 60 since the largest digit is 6, and we delete the odd 5 digit to obtain (0)60.
MATHEMATICA
a[n_] := Module[{d = IntegerDigits[n]}, FromDigits@ DeleteCases[d, _?(Mod[#, 2] != Mod[Max[d], 2] &)]]; Array[a, 100, 0] (* Amiram Eldar, Jan 19 2026 *)
PROG
(Python)
def a(n):
s = str(n)
dmax = max(s)
digset = "02468" if (dmax in "13579") else "13579"
r = "".join(d for d in s if d not in digset)
return int(r)
print([a(n) for n in range(76)])
(PARI) a(n) = if (n, my(d=digits(n), p=vecmax(d) % 2, list=List()); for (i=1, #d, if ((d[i] % 2) == p, listput(list, d[i]))); fromdigits(Vec(list)), 0); \\ Michel Marcus, Jan 19 2026
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Ali Sada and Michael S. Branicky, Jan 18 2026
STATUS
approved
