cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A038760 a(n) = n - floor(sqrt(n)) * ceiling(sqrt(n)).

This page as a plain text file.
%I A038760 #20 Jul 28 2022 15:18:56
%S A038760 0,0,0,1,0,-1,0,1,2,0,-2,-1,0,1,2,3,0,-3,-2,-1,0,1,2,3,4,0,-4,-3,-2,
%T A038760 -1,0,1,2,3,4,5,0,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,0,-6,-5,-4,-3,-2,-1,0,
%U A038760 1,2,3,4,5,6,7,0,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,0,-8,-7,-6,-5,-4
%N A038760 a(n) = n - floor(sqrt(n)) * ceiling(sqrt(n)).
%H A038760 Alois P. Heinz, <a href="/A038760/b038760.txt">Table of n, a(n) for n = 0..10000</a>
%F A038760 a(n) = n - A000196(n)*A003059(n) = n - A038759(n).
%e A038760 Sqrt(31) is between 5 and 6, and 31 - 6*5 = 1, so a(31)=1.
%p A038760 a:= n-> n -(x-> floor(x)*ceil(x))(sqrt(n)):
%p A038760 seq(a(n), n=0..100);  # _Alois P. Heinz_, Jan 03 2015
%t A038760 f[n_]:=n-Floor[Sqrt[n]]*Ceiling[Sqrt[n]];Table[f[n],{n,0,5!}] (* _Vladimir Joseph Stephan Orlovsky_, Mar 29 2010 *)
%o A038760 (PARI) a(n)=if(issquare(n),0,my(s=sqrtint(n));n-s^2-s) \\ _Charles R Greathouse IV_, Feb 07 2013
%o A038760 (Python)
%o A038760 from math import isqrt
%o A038760 def A038760(n): return m-k if (m:=n-(k:=isqrt(n))**2) else 0 # _Chai Wah Wu_, Jul 28 2022
%Y A038760 Cf. A053188.
%K A038760 sign,easy
%O A038760 0,9
%A A038760 _Henry Bottomley_, May 03 2000