login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = 9's complement of n-th palindrome (A002113).
2

%I #24 Jun 14 2024 01:49:09

%S 9,8,7,6,5,4,3,2,1,0,88,77,66,55,44,33,22,11,0,898,888,878,868,858,

%T 848,838,828,818,808,797,787,777,767,757,747,737,727,717,707,696,686,

%U 676,666,656,646,636,626,616

%N a(n) = 9's complement of n-th palindrome (A002113).

%C Leading zeros in the 9's complement are omitted.

%C For palindromes of the form 10^k-1 the corresponding entry is zero. Apart from this the entries are distinct.

%H Indranil Ghosh, <a href="/A084019/b084019.txt">Table of n, a(n) for n = 1..25000</a>

%e The 20th palindromic number A002113(20) is 101 having 9's complement 898 (999 - 101 = 898). So a(20) = 898. - _Indranil Ghosh_, Jan 30 2017

%o (Python)

%o # Program for generating the b-file

%o def a(n):

%o return 10**len(str(n))-n-1

%o i=0

%o j=1

%o while j<=250:

%o if i==int(str(i)[::-1]):

%o print(str(j)+" "+str(a(i)))

%o j+=1

%o i+=1 # _Indranil Ghosh_, Jan 30 2017

%o (Python)

%o def A084019(n):

%o if n == 1: return 9

%o y = 10*(x:=10**(len(str(n>>1))-1))

%o if n<x+y:

%o c = n-x

%o c = 10**len(str(c))-1-c

%o return c*x+int(str(c)[-2::-1]or 0)

%o else:

%o c = n-y

%o c = 10**len(str(c))-1-c

%o return c*y+int(str(c)[-1::-1]or 0) # _Chai Wah Wu_, Jun 13 2024

%Y Cf. A002113, A061601, A084020.

%K base,easy,nonn

%O 1,1

%A _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 23 2003