login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A351319 a(n) = floor(n/k), where k is the nearest square to n. 2
1, 2, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
For all n != 2, a(n) is 0 when less than the nearest square, A053187(n), and is 1 otherwise.
From Jon E. Schoenfield, Mar 22 2022: (Start)
After the first two terms, the sequence consists of runs of 0's and 1's, with run lengths 1,3,2,4,3,5,4,6,5,7,6,8,... = A028242.
For m >= 1, there are 2m integers k whose nearest square is m^2, namely, the m-1 integers (in the interval [m^2-m+1, m^2-1]) for which k < m^2 (hence a(k) = 0), followed by the m+1 integers (in the interval [m^2, m^2+m]) for which k >= m^2 (hence a(k) = 1). (End)
LINKS
FORMULA
a(n) = floor(n/k), where k = round(sqrt(n))^2 = A053187(n).
a(n) = A267708(n) for n != 2.
EXAMPLE
a(5) = floor(5/4) = 1.
MATHEMATICA
Table[Floor[n/Round[Sqrt[n]]^2], {n, 100}] (* Wesley Ivan Hurt, Mar 18 2022 *)
PROG
(Python)
import math
def a(n):
k = math.isqrt(n)
if n - k**2 > k: k += 1
return n // k**2;
for n in range(1, 101):
print("{}, ".format(a(n)), end="")
(Python)
from math import isqrt
def A351319(n): return n if n <= 2 else int((k:=isqrt(n))**2+k-n+1 > 0) # Chai Wah Wu, Mar 26 2022
(PARI) a(n) = if(n==2, 2, my(r, s=sqrtint(n, &r)); r<=s); \\ Kevin Ryde, Mar 23 2022
CROSSREFS
Cf. A000194, A053187 (nearest square), A028242 (run lengths).
Cf. A267708 (essentially the same).
Sequence in context: A133008 A102550 A293139 * A213725 A213726 A116929
KEYWORD
nonn,easy
AUTHOR
Joelle H. Kassir, Mar 18 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 05:56 EDT 2024. Contains 371964 sequences. (Running on oeis4.)