login
Beatty discrepancy (defined in A138253) giving the closeness of the pair (A136497,A136498) to the Beatty pair (A001951,A001952).
2

%I #32 Aug 30 2022 02:01:13

%S 1,2,1,1,1,1,2,1,2,1,1,2,1,2,1,1,1,1,2,1,1,1,1,2,1,2,1,1,1,1,2,1,1,1,

%T 1,2,1,2,1,1,2,1,2,1,1,1,1,2,1,2,1,1,2,1,2,1,1,1,1,2,1,1,1,1,2,1,2,1,

%U 1,2,1,2,1,1,1,1,2,1,2,1,1,2,1,2,1,1,1,1,2,1,1,1,1,2,1,2,1,1,1,1,2,1,1,1,1

%N Beatty discrepancy (defined in A138253) giving the closeness of the pair (A136497,A136498) to the Beatty pair (A001951,A001952).

%C Old definition was "Beatty discrepancy of the complementary equation b(n) = a(a(n)) + a(n)".

%H Muniru A Asiru, <a href="/A138330/b138330.txt">Table of n, a(n) for n = 1..1000</a>

%H Clark Kimberling, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL10/Kimberling/kimberling26.html"> Complementary Equations, Journal of Integer Sequences, Vol. 10 (2007), Article 07.1.4.

%F a(n) = d(n) - c(c(n)) - c(n), where c(n) = A001951 and d(n) = A001952.

%F a(n) = 2*n - A007069(n). - _Benoit Cloitre_, May 08 2008

%F a(n) = A059648(n+1) + 1. - _Michel Dekking_, Nov 11 2018

%e d(1) - c(c(1)) - c(1) = 3 - 1 - 1 = 1;

%e d(2) - c(c(2)) - c(2) = 6 - 2 - 2 = 2;

%e d(3) - c(c(3)) - c(3) = 10 - 5 - 4 = 1;

%e d(4) - c(c(4)) - c(4) = 13 - 7 - 5 = 1.

%p a:=n->2*n-floor(sqrt(2)*floor(sqrt(2)*n)): seq(a(n),n=1..120); # _Muniru A Asiru_, Nov 11 2018

%t Table[2 n - Floor[Sqrt[2] Floor[Sqrt[2] n]], {n, 1, 100}] (* _Vincenzo Librandi_, Nov 12 2018 *)

%o (PARI) a(n)=2*n-floor(sqrt(2)*floor(sqrt(2)*n)) \\ _Benoit Cloitre_, May 08 2008

%o (Magma) [2*n - Floor(Sqrt(2)*Floor(Sqrt(2)*n)): n in [1..100]]; // _Vincenzo Librandi_, Nov 12 2018

%o (Python)

%o from math import isqrt

%o def A138330(n): return (m:=n<<1)-isqrt(isqrt(n*m)**2<<1) # _Chai Wah Wu_, Aug 29 2022

%Y Cf. A001951, A001952, A136497, A136498, A138253, A059648.

%K nonn

%O 1,2

%A _Clark Kimberling_, Mar 14 2008

%E Definition revised by _N. J. A. Sloane_, Dec 16 2018