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!)
A040163 a(n) is the absolute value of (the first digit of n minus the last digit of n). 8

%I #26 Apr 24 2024 12:59:58

%S 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,

%T 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,

%U 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

%N a(n) is the absolute value of (the first digit of n minus the last digit of n).

%H David F. Marrs, <a href="/A040163/b040163.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = abs(floor(n / 10 ^ floor(log_10(n))) - (n - floor(n / 10) * 10)) - _David F. Marrs_, Oct 14 2018

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

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

%t Array[Abs[First@ # - Last@ #] &@ IntegerDigits@ # &, 106] (* _Michael De Vlieger_, Oct 15 2018 *)

%o (PARI) a(n) = my(digs = digits(n)); abs(digs[1] - digs[#digs]); \\ _Michel Marcus_, Sep 27 2013

%o (PARI) apply( {A040163(n)=abs(n\10^logint(n+!n,10)-n%10)}, [0..111]) \\ _M. F. Hasler_, Apr 22 2024

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

%Y Cf. A000030 (first digit of n), A010879 (last digit of n).

%Y Cf. A037904, A040114, A040115, A040997.

%K nonn,base,changed

%O 1,13

%A _Felice Russo_

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 April 24 19:06 EDT 2024. Contains 371962 sequences. (Running on oeis4.)