The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A040997 Absolute value of first digit of n minus sum of other digits of n. 15
1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
This is different from |A055017(n)| = |(x1 + x3 + ...) - (x2 + x4 + ...)|, where x1,...,xk are the digits of n. - M. F. Hasler, Nov 09 2019
LINKS
FORMULA
If decimal expansion of n is x1 x2 ... xk then a(n) = |x1-x2-x3- ... -xk|.
a(n) = abs(A000030(n) - A007953(A217657(n)). - Reinhard Zumkeller, Oct 10 2012
EXAMPLE
a(371) = |3-7-1| = 5.
PROG
(Haskell) a040997 n = abs $ a000030 n - a007953 (a217657 n) -- Reinhard Zumkeller, Oct 10 2012
(PARI) apply( A040997(n)={abs(vecsum(n=digits(n))-n[1]*2)}, [1..199]) \\ M. F. Hasler, Nov 09 2019
CROSSREFS
Sequence in context: A076313 A055017 A225693 * A256851 A353906 A247149
KEYWORD
nonn,base,easy
AUTHOR
EXTENSIONS
Name edited and incorrect formula deleted by M. F. Hasler, Nov 09 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 17 12:26 EDT 2024. Contains 372600 sequences. (Running on oeis4.)