login
a(n) = ceiling((n-R(n))^2/(n+R(n))), where R(n) is the digit reversal of n.
1

%I #21 Jan 26 2022 07:25:03

%S 0,0,0,0,0,0,0,0,0,8,0,3,8,14,20,27,34,41,48,15,3,0,2,5,10,15,21,27,

%T 33,23,8,2,0,2,4,8,12,17,23,30,14,5,2,0,1,3,7,10,15,37,20,10,4,1,0,1,

%U 3,6,9,45,27,15,8,3,1,0,1,3,5,52,34,21,12,7,3,1,0,1,2,59,41

%N a(n) = ceiling((n-R(n))^2/(n+R(n))), where R(n) is the digit reversal of n.

%C If n is a palindrome, R(n) = n and n-R(n) = 0, thus a(n) = 0. So, for a given length of the sequence, the number of zeros is equal to the number of palindromic n's. For example, in the interval {0, 100} there are 18 zeros corresponding to the 18 palindromic n's: 1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88 and 99.

%C From the 11th term, the sequence can be seen as a series of subsequences separated by a zero. Between two zeros, the terms start by increasing, then go through a maximum and finally decrease as shown for example by the zero separated subsets: [3,8,14,20,27,34,41,48,15,3]; [2,5,10,15,21,27,33,23,8,2]; [2,4,8,12,17,23,30,14,5,2].

%C The above described characteristics of the sequence give well-structured patterns to nice graphs.

%H Rémy Sigrist, <a href="/A350811/b350811.txt">Table of n, a(n) for n = 1..10000</a>

%e For n = 1, R(n) = 1, thus a(1) = ceiling((1-1)^2/(1+1)) = 0.

%e For n = 10, R(n) = 1, thus a(10) = ceiling((10-1)^2/(10+1)) = 8.

%e For n = 22, R(n) = 22, thus a(22) = ceiling((22-22)^2/(22+22)) = 0.

%t Table[Ceiling[(n-FromDigits[Reverse[IntegerDigits[n]]])^2/(n+FromDigits[Reverse[IntegerDigits[n]]])],{n,81}] (* _Stefano Spezia_, Jan 18 2022 *)

%o (PARI) a(n)=my(x=fromdigits(Vecrev(digits(n))));r=ceil((n-x)^2/(n+x));

%o for(n=1,2000,print1(a(n)", "))

%o (Python)

%o def R(n): return int(str(n)[::-1])

%o def a(n):

%o Rn = R(n)

%o q, r = divmod((n-Rn)**2, n+Rn)

%o return q if r == 0 else q + 1

%o print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Jan 17 2022

%Y Cf. A004086, A002113.

%K nonn,base,easy,look

%O 1,10

%A _Claude H. R. Dequatre_, Jan 17 2022