%I #17 Jan 18 2022 06:30:36
%S 0,0,1,1,1,1,2,3,3,3,4,4,5,6,7,8,7,8,9,9,10,11,12,13,14,13,14,15,16,
%T 16,17,18,19,20,21,22,21,22,23,24,25,25,26,27,28,29,30,31,32,31,32,33,
%U 34,35,36,36,37,38,39,40,41,42,43,44,43,44,45,46,47,48,49,49,50
%N a(n) = ceiling((n-R(ceiling(n^(1/2))))^2/(n+R(ceiling(n^(1/2))))), where R(ceiling(n^(1/2))) is the digit reversal of ceiling(n^(1/2)).
%C Blocks of consecutive numbers, duplicates, gaps and irregularities in the sequence explain the separated segments with small oscillations as shown by the graphs.
%e For n = 1, R(ceiling(n^(1/2)) = 1, thus a(1) = ceiling((1-1)^2/(1+1)) = 0.
%e For n = 16, R(ceiling(n^(1/2)) = 4, thus a(16) = ceiling((16-4)^2/(16+4)) = 8.
%e For n = 21, R(ceiling(n^(1/2)) = 5, thus a(21) = ceiling((21-5)^2/(21+5)) = 10.
%t Table[Ceiling[(n-FromDigits[Reverse[IntegerDigits[Ceiling[n^(1/2)]]]])^2/(n+FromDigits[Reverse[IntegerDigits[Ceiling[n^(1/2)]]]])],{n,73}] (* _Stefano Spezia_, Jan 18 2022 *)
%o (PARI) a(n)=my(x=fromdigits(Vecrev(digits(ceil(sqrt(n))))));r=ceil((n-x)^2/(n+x));
%o for(n=1,2000,print1(a(n)", "))
%o (Python)
%o from math import isqrt
%o def R(n): return int(str(n)[::-1])
%o def a(n):
%o root = isqrt(n)
%o Rcroot = R(root) if root**2 ==n else R(root+1)
%o q, r = divmod((n-Rcroot)**2, n+Rcroot)
%o return q if r == 0 else q + 1
%o print([a(n) for n in range(1, 94)]) # _Michael S. Branicky_, Jan 17 2022
%Y Cf. A004086.
%K nonn,base,easy
%O 1,7
%A _Claude H. R. Dequatre_, Jan 17 2022
|