A383787 Largest number obtainable by either keeping each decimal digit d in n or replacing it with 9-d.
8, 7, 6, 5, 5, 6, 7, 8, 9, 89, 88, 87, 86, 85, 85, 86, 87, 88, 89, 79, 78, 77, 76, 75, 75, 76, 77, 78, 79, 69, 68, 67, 66, 65, 65, 66, 67, 68, 69, 59, 58, 57, 56, 55, 55, 56, 57, 58, 59, 59, 58, 57, 56, 55, 55, 56, 57, 58, 59, 69, 68, 67, 66, 65, 65, 66, 67, 68, 69, 79, 78, 77, 76, 75, 75, 76, 77, 78
Offset: 1
Examples
To find a(129) we replace 1 with 8 and 2 with 7. So, a(129) = 879.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..10^6.
Programs
-
Mathematica
a[n_] := FromDigits[IntegerDigits[n] /. d_?(# < 5 &) -> 9 - d]; Array[a, 100] (* Amiram Eldar, May 10 2025 *)
-
PARI
a(n) = fromdigits(apply(x->(if (x<5, 9-x, x)), digits(n))); \\ Michel Marcus, May 12 2025
-
Python
def a(n): return int("".join(d if d>"4" else str(9-int(d)) for d in str(n))) print([a(n) for n in range(1, 79)]) # Michael S. Branicky, May 10 2025