login
Delete from n all digits of opposite parity to its largest digit.
1

%I #27 Jan 23 2026 21:11:58

%S 0,1,2,3,4,5,6,7,8,9,1,11,2,13,4,15,6,17,8,19,20,2,22,3,24,5,26,7,28,

%T 9,3,31,3,33,4,35,6,37,8,39,40,4,42,4,44,5,46,7,48,9,5,51,5,53,5,55,6,

%U 57,8,59,60,6,62,6,64,6,66,7,68,9,7,71,7,73,7,75

%N Delete from n all digits of opposite parity to its largest digit.

%C 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.

%H Michael S. Branicky, <a href="/A391869/b391869.txt">Table of n, a(n) for n = 0..10000</a>

%F a(k) = k for k in A059708.

%e a(1121) = 2 since the largest digit is 2, and we delete the odd 1 digits to obtain 2.

%e a(3674) = 37 since the largest digit is 7, and we delete the even digits 6 and 4 to obtain 37.

%e a(5060) = 60 since the largest digit is 6, and we delete the odd 5 digit to obtain (0)60.

%t a[n_] := Module[{d = IntegerDigits[n]}, FromDigits@ DeleteCases[d, _?(Mod[#, 2] != Mod[Max[d], 2] &)]]; Array[a, 100, 0] (* _Amiram Eldar_, Jan 19 2026 *)

%o (Python)

%o def a(n):

%o s = str(n)

%o dmax = max(s)

%o digset = "02468" if (dmax in "13579") else "13579"

%o r = "".join(d for d in s if d not in digset)

%o return int(r)

%o print([a(n) for n in range(76)])

%o (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

%Y Cf. A059708 (set of fixed points).

%K nonn,base,easy

%O 0,3

%A _Ali Sada_ and _Michael S. Branicky_, Jan 18 2026