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.

User: Joelle H. Kassir

Joelle H. Kassir's wiki page.

Joelle H. Kassir has authored 2 sequences.

A353024 Largest k such that A007504(k) <= n^2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 45, 46, 47, 47
Offset: 1

Author

Joelle H. Kassir, Apr 17 2022

Keywords

Crossrefs

Programs

  • PARI
    first(N)=my(v=vector(N),s,k,n=1,n2=1); forprime(p=2,, s+=p; k++; while(s>n2, v[n]=k-1; if(n++>N, return(v)); n2=n^2)) \\ Charles R Greathouse IV, Apr 18 2022
    
  • PARI
    a(n)=my(n2=n^2,s,k); forprime(p=2,, s+=p; k++; if(s>n2, return(k-1))) \\ Charles R Greathouse IV, Apr 18 2022
  • Python
    from sympy import prime
    def a(n):
        k = 1
        total = 0
        while True:
            total += prime(k)
            if total > n**2:
                break
            k += 1
        return k-1
    

Formula

a(n) = A337769(n) - 1.
a(n) ~ sqrt(2)*n/sqrt(log n). - Charles R Greathouse IV, Apr 18 2022
a(n) = A350174(n^2). - Kevin Ryde, Apr 19 2022

A351319 a(n) = floor(n/k), where k is the nearest square to n.

Original entry on oeis.org

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
Offset: 1

Author

Joelle H. Kassir, Mar 18 2022

Keywords

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)

Examples

			a(5) = floor(5/4) = 1.
		

Crossrefs

Cf. A000194, A053187 (nearest square), A028242 (run lengths).
Cf. A267708 (essentially the same).

Programs

  • Mathematica
    Table[Floor[n/Round[Sqrt[n]]^2], {n, 100}] (* Wesley Ivan Hurt, Mar 18 2022 *)
  • PARI
    a(n) = if(n==2,2, my(r,s=sqrtint(n,&r)); r<=s); \\ Kevin Ryde, Mar 23 2022
  • 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
    

Formula

a(n) = floor(n/k), where k = round(sqrt(n))^2 = A053187(n).
a(n) = A267708(n) for n != 2.