login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A040163 a(n) is the absolute value of (the first digit of n minus the last digit of n). 8
0, 0, 0, 0, 0, 0, 0, 0, 0, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,13

LINKS

David F. Marrs, Table of n, a(n) for n = 1..10000

FORMULA

a(n) = abs(floor(n / 10 ^ floor(log_10(n))) - (n - floor(n / 10) * 10)) - David F. Marrs, Oct 14 2018

EXAMPLE

a(371) = abs(3 - 1) = 2.

a(567) = abs(5 - 7) = 2.

MATHEMATICA

Array[Abs[First@ # - Last@ #] &@ IntegerDigits@ # &, 106] (* Michael De Vlieger, Oct 15 2018 *)

PROG

(PARI) a(n) = my(digs = digits(n)); abs(digs[1] - digs[#digs]); \\ Michel Marcus, Sep 27 2013

(Python) for n in range(1, 51): print(abs(int(str(n)[0])-int(str(n)[-1]))) # David F. Marrs, Oct 14 2018

CROSSREFS

Cf. A037904, A040114, A040115, A040997.

Sequence in context: A070615 A040114 A064834 * A113608 A040115 A080465

Adjacent sequences:  A040160 A040161 A040162 * A040164 A040165 A040166

KEYWORD

nonn,base

AUTHOR

Felice Russo

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 4 07:32 EDT 2020. Contains 333213 sequences. (Running on oeis4.)