OFFSET
1,1
COMMENTS
The plot looks like multiple V shapes. A new V shape occurs for each interval n = 10^k .. 10^(k+1)-1, with the bottom of the V at a(5*10^k) = 0.
All terms are even.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..9999
Erhan Tezcan, Github Repo includes plots and the code.
FORMULA
a(n) = abs(2*n - 10^A055642(n)).
a(10*n) = 10*a(n).
EXAMPLE
n=10 has length 2, so a(10) = |20-100| = 80.
MATHEMATICA
Table[Abs[2n-10^IntegerLength[n]], {n, 70}] (* Harvey P. Dale, Dec 11 2022 *)
PROG
(Python)
def a(n : int) -> int:
return abs((n << 1) - (10 ** len(str(n))))
(PARI) a(n) = abs(2*n-10^max(1, #digits(n))) \\ Rémy Sigrist, May 30 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Erhan Tezcan, Apr 10 2021
STATUS
approved