login
A343275
a(n) = |2*n - 10^length(n)|.
1
8, 6, 4, 2, 0, 2, 4, 6, 8, 80, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40
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
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
Cf. A055642.
Sequence in context: A263181 A298978 A199151 * A177154 A059631 A333198
KEYWORD
nonn,base
AUTHOR
Erhan Tezcan, Apr 10 2021
STATUS
approved