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.

Showing 1-10 of 54 results. Next

A258613 Numbers m that are coprime to the largest square <= m, cf. A048760.

Original entry on oeis.org

1, 2, 3, 5, 7, 10, 11, 13, 14, 17, 19, 21, 23, 26, 27, 28, 29, 31, 32, 33, 34, 37, 41, 43, 47, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 65, 67, 69, 71, 73, 75, 77, 79, 82, 83, 85, 86, 88, 89, 91, 92, 94, 95, 97, 98, 101, 103, 107, 109, 111, 113, 117
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 05 2015

Keywords

Examples

			a(8) = 13: GCD(13,A048760(13)) = GCD(13,9) = 1.
a(9) = 14: GCD(14,A048760(14)) = GCD(14,9) = 1.
GCD(15,A048760(15)) = GCD(15,9) = 3 > 1, therefore 15 is not a term.
		

Crossrefs

Cf. A013661, A074695, A048760, A258614 (complement).

Programs

  • Haskell
    a258613 n = a258613_list !! (n-1)
    a258613_list = filter ((== 1) . a074695) [1..]
    
  • Mathematica
    Select[Range[200],CoprimeQ[#,Floor[Sqrt[#]]^2]&] (* Harvey P. Dale, Jun 25 2017 *)
  • PARI
    isok(n) = gcd(n, sqrtint(n)^2) == 1; \\ Michel Marcus, Jun 06 2015

Formula

A074695(a(n)) = 1.
The number of terms that do not exceed x is x/zeta(2) + O(sqrt(x)*log(x)) (Lambek and Moser, 1955). - Amiram Eldar, Nov 19 2024

A072690 a(n) = (n - A048760(n)) * (A048761(n) - n).

Original entry on oeis.org

0, 2, 2, 0, 4, 6, 6, 4, 0, 6, 10, 12, 12, 10, 6, 0, 8, 14, 18, 20, 20, 18, 14, 8, 0, 10, 18, 24, 28, 30, 30, 28, 24, 18, 10, 0, 12, 22, 30, 36, 40, 42, 42, 40, 36, 30, 22, 12, 0, 14, 26, 36, 44, 50, 54, 56, 56, 54, 50, 44, 36, 26, 14, 0, 16, 30, 42, 52, 60, 66, 70, 72, 72, 70, 66
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 02 2002

Keywords

Comments

a(n)=0 iff n is a square.

Crossrefs

a(n) = A053186(n) * A068527(n).

Formula

a(n) = A053186(n) * (A072689(n) - A053186(n)).

A000196 Integer part of square root of n. Or, number of positive squares <= n. Or, n appears 2n+1 times.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10
Offset: 0

Views

Author

Keywords

Comments

Also the integer part of the geometric mean of the divisors of n. - Amarnath Murthy, Dec 19 2001
Number of numbers k (<= n) with an odd number of divisors. - Benoit Cloitre, Sep 07 2002
Also, for n > 0, the number of digits when writing n in base where place values are squares, cf. A007961; A190321(n) <= a(n). - Reinhard Zumkeller, May 08 2011
The least monotonic left inverse of squares, A000290. That is, the lexicographically least nondecreasing sequence a(n) such that a(A000290(n)) = n. - Antti Karttunen, Oct 06 2017

Examples

			G.f. = x + x^2 + x^3 + 2*x^4 + 2*x^5 + 2*x^6 + 2*x^7 + 2*x^8 + 3*x^9 + ...
		

References

  • Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, p. 73, problem 23.
  • Lionel Levine, Fractal sequences and restricted Nim, Ars Combin. 80 (2006), 113-127.
  • Paul J. McCarthy, Introduction to Arithmetical Functions, Springer Verlag, 1986, p. 28.
  • N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

Crossrefs

Programs

  • Haskell
    import Data.Bits (shiftL, shiftR)
    a000196 :: Integer -> Integer
    a000196 0 = 0
    a000196 n = newton n (findx0 n 1) where
       -- find x0 == 2^(a+1), such that 4^a <= n < 4^(a+1).
       findx0 0 b = b
       findx0 a b = findx0 (a `shiftR` 2) (b `shiftL` 1)
       newton n x = if x' < x then newton n x' else x
                    where x' = (x + n `div` x) `div` 2
    a000196_list = concat $ zipWith replicate [1,3..] [0..]
    -- Reinhard Zumkeller, Apr 12 2012, Oct 23 2010
    
  • Julia
    a(n) = isqrt(n) # Paul Muljadi, Jun 03 2024
  • Magma
    [Isqrt(n) : n in [0..100]];
    
  • Maple
    Digits := 100; A000196 := n->floor(evalf(sqrt(n)));
  • Mathematica
    Table[n, {n, 0, 20}, {2n + 1}] //Flatten (* Zak Seidov Mar 19 2011 *)
    IntegerPart[Sqrt[Range[0, 110]]] (* Harvey P. Dale, May 23 2012 *)
    Floor[Sqrt[Range[0, 99]]] (* Alonso del Arte, Dec 31 2013 *)
    a[ n_] := SeriesCoefficient[ (EllipticTheta[ 3, 0, x]  - 1) / (2 (1 - x)), {x, 0, n}]; (* Michael Somos, May 28 2014 *)
  • PARI
    {a(n) = if( n<0, 0, sqrtint(n))};
    
  • Python
    # from http://code.activestate.com/recipes/577821-integer-square-root-function/
    def A000196(n):
      if n < 0:
        raise ValueError('only defined for nonnegative n')
      if n == 0:
        return 0
      a, b = divmod(n.bit_length(), 2)
      j = 2**(a+b)
      while True:
        k = (j + n//j)//2
        if k >= j:
          return j
        j = k
    print([A000196(n)for n in range(102)])
    # Jason Kimberley, Nov 09 2016
    
  • Python
    from math import isqrt
    def a(n): return isqrt(n)
    print([a(n) for n in range(102)]) # Michael S. Branicky, Feb 15 2023
    
  • Scheme
    ;; The following implementation uses higher order function LEFTINV-LEASTMONO-NC2NC from my IntSeq-library. It returns the least monotonic left inverse of any strictly growing function (see the comment-section for the definition) and although it does not converge as fast to the result as many specialized integer square root algorithms, at least it does not involve any floating point arithmetic. Thus with correctly implemented bignums it will produce correct results even with very large arguments, in contrast to just taking the floor of (sqrt n).
    ;; Source of LEFTINV-LEASTMONO-NC2NC can be found under https://github.com/karttu/IntSeq/blob/master/src/Transforms/transforms-core.ss and the definition of A000290 is given under that entry.
    (define A000196 (LEFTINV-LEASTMONO-NC2NC 0 0 A000290)) ;; Antti Karttunen, Oct 06 2017
    

Formula

a(n) = Card(k, 0 < k <= n such that k is relatively prime to core(k)) where core(x) is the squarefree part of x. - Benoit Cloitre, May 02 2002
a(n) = a(n-1) + floor(n/(a(n-1)+1)^2), a(0) = 0. - Reinhard Zumkeller, Apr 12 2004
From Hieronymus Fischer, May 26 2007: (Start)
a(n) = Sum_{k=1..n} A010052(k).
G.f.: g(x) = (1/(1-x))*Sum_{j>=1} x^(j^2) = (theta_3(0, x) - 1)/(2*(1-x)) where theta_3 is a Jacobi theta function. (End)
a(n) = floor(A000267(n)/2). - Reinhard Zumkeller, Jun 27 2011
a(n) = floor(sqrt(n)). - Arkadiusz Wesolowski, Jan 09 2013
Sum_{n>0} 1/a(n)^s = 2*zeta(s-1) + zeta(s), where zeta is the Riemann zeta function. - Enrique Pérez Herrero, Oct 15 2013
From Wesley Ivan Hurt, Dec 31 2013: (Start)
a(n) = Sum_{i=1..n} (A000005(i) mod 2), n > 0.
a(n) = (1/2)*Sum_{i=1..n} (1 - (-1)^A000005(i)), n > 0. (End)
a(n) = sqrt(A048760(n)), n >= 0. - Wolfdieter Lang, Mar 24 2015
a(n) = Sum_{k=1..n} floor(n/k)*lambda(k) = Sum_{m=1..n} Sum_{d|m} lambda(d) where lambda(j) is Liouville lambda function, A008836. - Geoffrey Critzer, Apr 01 2015
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) (A002162). - Amiram Eldar, May 02 2023

A053186 Square excess of n: difference between n and largest square <= n.

Original entry on oeis.org

0, 0, 1, 2, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
Offset: 0

Views

Author

Henry Bottomley, Mar 01 2000

Keywords

Comments

From David W. Wilson, Jan 05 2009: (Start)
More generally we may consider sequences defined by:
a(n) = n^j - (largest k-th power <= n^j),
a(n) = n^j - (largest k-th power < n^j),
a(n) = (largest k-th power >= n^j) - n^j,
a(n) = (largest k-th power > n^j) - n^j,
for small values of j and k.
The present entry is the first of these with j = 1 and n = 2.
It might be interesting to add further examples to the OEIS. (End)
a(A000290(n)) = 0; a(A005563(n)) = 2*n. - Reinhard Zumkeller, May 20 2009
0 ^ a(n) = A010052(n). - Reinhard Zumkeller, Feb 12 2012
From Frank M Jackson, Sep 21 2017: (Start)
The square excess of n has a reference in the Bakhshali Manuscript of Indian mathematics elements of which are dated between AD 200 and 900. A section within describes how to estimate the approximate value of irrational square roots. It states that for n an integer with an irrational square root, let b^2 be the nearest perfect square < n and a (=a(n)) be the square excess of n, then
sqrt(n) = sqrt(b^2+a) ~ b + a/(2b) - (a/(2b))^2/(2(b+a/(2b))). (End)

Crossrefs

Cf. A002262, A048760. A071797(n) = 1 + a(n-1).
Cf. A002262. - Reinhard Zumkeller, May 20 2009

Programs

  • Haskell
    a053186 n = n - a048760 n
    a053186_list = f 0 0 (map fst $ iterate (\(y,z) -> (y+z,z+2)) (0,1))
       where f e x ys'@(y:ys) | x < y  = e : f (e + 1) (x + 1) ys'
                              | x == y = 0 : f 1 (x + 1) ys
    -- Reinhard Zumkeller, Apr 27 2012
  • Maple
    A053186 := proc(n) n-(floor(sqrt(n)))^2 ; end proc;
  • Mathematica
    f[n_] := n - (Floor@ Sqrt@ n)^2; Table[f@ n, {n, 0, 94}] (* Robert G. Wilson v, Jan 23 2009 *)
  • PARI
    A053186(n)= { if(n<0,0,n-sqrtint(n)^2) }
    

Formula

a(n) = n - A048760(n) = n - floor(sqrt(n))^2.
a(n) = f(n,1) with f(n,m) = if n < m then n else f(n-m,m+2). - Reinhard Zumkeller, May 20 2009

A053610 Number of positive squares needed to sum to n using the greedy algorithm.

Original entry on oeis.org

1, 2, 3, 1, 2, 3, 4, 2, 1, 2, 3, 4, 2, 3, 4, 1, 2, 3, 4, 2, 3, 4, 5, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 2, 3, 4, 5, 1, 2, 3, 4, 2, 3, 4, 5, 3, 2, 3, 4, 5, 3, 4, 1, 2, 3, 4, 2, 3, 4, 5, 3, 2, 3, 4, 5, 3, 4, 5, 2, 1, 2, 3, 4, 2, 3, 4, 5, 3, 2, 3, 4, 5, 3, 4, 5, 2, 3, 4, 1, 2, 3, 4
Offset: 1

Views

Author

Jud McCranie, Mar 19 2000

Keywords

Comments

Define f(n) = n - x^2 where (x+1)^2 > n >= x^2. a(n) = number of iterations in f(...f(f(n))...) to reach 0.
a(n) = 1 iff n is a perfect square.
Also sum of digits when writing n in base where place values are squares, cf. A007961. - Reinhard Zumkeller, May 08 2011
The sequence could have started with a(0)=0. - Thomas Ordowski, Jul 12 2014
The sequence is not bounded, see A006892. - Thomas Ordowski, Jul 13 2014

Examples

			7=4+1+1+1, so 7 requires 4 squares using the greedy algorithm, so a(7)=4.
		

Crossrefs

Cf. A006892 (positions of records), A055401, A007961.
Cf. A000196, A000290, A057945 (summing triangular numbers).

Programs

  • Haskell
    a053610 n = s n $ reverse $ takeWhile (<= n) $ tail a000290_list where
      s _ []                 = 0
      s m (x:xs) | x > m     = s m xs
                 | otherwise = m' + s r xs where (m',r) = divMod m x
    -- Reinhard Zumkeller, May 08 2011
    
  • Maple
    A053610 := proc(n)
        local a,x;
        a := 0 ;
        x := n ;
        while x > 0 do
            x := x-A048760(x) ;
            a := a+1 ;
        end do:
        a ;
    end proc: # R. J. Mathar, May 13 2016
  • Mathematica
    f[n_] := (n - Floor[Sqrt[n]]^2); g[n_] := (m = n; c = 1; While[a = f[m]; a != 0, c++; m = a]; c); Table[ g[n], {n, 1, 105}]
  • PARI
    A053610(n,c=1)=while(n-=sqrtint(n)^2,c++);c \\ M. F. Hasler, Dec 04 2008
    
  • Python
    from math import isqrt
    def A053610(n):
        c = 0
        while n:
            n -= isqrt(n)**2
            c += 1
        return c # Chai Wah Wu, Aug 01 2023

Formula

a(n) = A007953(A007961(n)). - Henry Bottomley, Jun 01 2000
a(n) = a(n - floor(sqrt(n))^2) + 1 = a(A053186(n)) + 1 [with a(0) = 0]. - Henry Bottomley, May 16 2000
A053610 = A002828 + A062535. - M. F. Hasler, Dec 04 2008

A048761 Smallest square greater than or equal to n.

Original entry on oeis.org

0, 1, 4, 4, 4, 9, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16, 25, 25, 25, 25, 25, 25, 25, 25, 25, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81
Offset: 0

Views

Author

Charles T. Le (charlestle(AT)yahoo.com)

Keywords

Comments

From M. F. Hasler, Oct 05 2009: (Start)
For each k > 0, the term k^2 is listed 2k - 1 times.
a(n+1) is the least square greater than n. (End)

References

  • Krassimir Atanassov, On the 40th and 41st Smarandache Problems, Notes on Number Theory and Discrete Mathematics, Sophia, Bulgaria, Vol. 4, No. 3 (1998), 101-104.
  • J. Castillo, Other Smarandache Type Functions: Inferior/Superior Smarandache f-part of x, Smarandache Notions Journal, Vol. 10, No. 1-2-3, 1999, 202-204.

Crossrefs

Programs

  • Haskell
    a048761 n = (a000196 n + 1 - a010052 n) ^ 2
    a048761_list = 0 : concat (f 1 1) where
       f u v = (take v $ repeat u) : f (u + v + 2) (v + 2)
    -- Reinhard Zumkeller, Mar 16 2014
    
  • Magma
    [Ceiling(Sqrt(n))^2: n in [0..80]]; // Vincenzo Librandi, Jun 21 2015
  • Maple
    A048761 := proc(n)
            ceil(sqrt(n)) ;
            %^2 ;
    end proc: # R. J. Mathar, Sep 26 2011
  • Mathematica
    (Ceiling[Sqrt[Range[0, 99]]])^2 (* Alonso del Arte, Jun 21 2015 *)
  • PARI
    A048761(n)=if(n,(sqrtint(n-1)+1)^2,0) \\ M. F. Hasler, Oct 05 2009
    

Formula

a(n) = (A000196(n) + 1 - A010052(n))^2. - Reinhard Zumkeller, Mar 16 2014
a(n) = (ceiling(sqrt(n)))^2. - Alonso del Arte, Jun 21 2015
Sum_{n>=1} 1/a(n)^2 = 2*zeta(3) - Pi^4/90. - Amiram Eldar, Aug 15 2022

Extensions

Missing a(49) = 49 inserted by Reinhard Zumkeller, Mar 16 2014

A071797 Restart counting after each new odd integer (a fractal sequence).

Original entry on oeis.org

1, 1, 2, 3, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
Offset: 1

Views

Author

Antonio Esposito, Jun 06 2002

Keywords

Comments

The following sequences all have the same parity: A004737, A006590, A027052, A071028, A071797, A078358, A078446.
This is also a triangle read by rows in which row n lists the first 2*n-1 positive integers, n >= 1 (see example). - Omar E. Pol, May 29 2012
a(n) mod 2 = A071028(n). - Boris Putievskiy, Jul 24 2013
The triangle in the example is the triangle used by Kircheri in 1664. See the link "Mundus Subterraneus". - Charles Kusniec, Sep 11 2022

Examples

			a(1)=1; a(9)=5; a(10)=1;
From _Omar E. Pol_, May 29 2012: (Start)
Written as a triangle the sequence begins:
  1;
  1, 2, 3;
  1, 2, 3, 4, 5;
  1, 2, 3, 4, 5, 6, 7;
  1, 2, 3, 4, 5, 6, 7, 8, 9;
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13;
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15;
Row n has length 2*n - 1 = A005408(n-1). (End)
		

Crossrefs

Cf. A074294.
Row sums give positive terms of A000384.

Programs

  • Haskell
    import Data.List (inits)
    a071797 n = a071797_list !! (n-1)
    a071797_list = f $ tail $ inits [1..] where
       f (xs:_:xss) = xs ++ f xss
    -- Reinhard Zumkeller, Apr 14 2014
  • Maple
    A071797 := proc(n)
        n-A048760(n-1) ;
    end proc: # R. J. Mathar, May 29 2016
  • Mathematica
    Array[Range[2# - 1]&, 10] // Flatten (* Jean-François Alcover, Jan 30 2018 *)
  • PARI
    a(n)=if(n<1,0,n-sqrtint(n-1)^2)
    

Formula

a(n) = 1 + A053186(n-1).
a(n) = n - 1 - ceiling(sqrt(n))*(ceiling(sqrt(n))-2); n > 0.
a(n) = n - floor(sqrt(n-1))^2, distance between n and the next smaller square. - Marc LeBrun, Jan 14 2004

A056892 a(n) = square excess of the n-th prime.

Original entry on oeis.org

1, 2, 1, 3, 2, 4, 1, 3, 7, 4, 6, 1, 5, 7, 11, 4, 10, 12, 3, 7, 9, 15, 2, 8, 16, 1, 3, 7, 9, 13, 6, 10, 16, 18, 5, 7, 13, 19, 23, 4, 10, 12, 22, 24, 1, 3, 15, 27, 2, 4, 8, 14, 16, 26, 1, 7, 13, 15, 21, 25, 27, 4, 18, 22, 24, 28, 7, 13, 23, 25, 29, 35, 6, 12, 18, 22, 28, 36, 1, 9, 19, 21
Offset: 1

Views

Author

Henry Bottomley, Jul 05 2000

Keywords

Examples

			a(5) = 2 since the 5th prime is 11 = 3^2 + 2.
From _M. F. Hasler_, Oct 19 2018: (Start)
Written as a table, starting a new row when a square is reached, the sequence reads:
  1, 2,    // = 2 - 1, 3 - 1 = {primes between 1^2 = 1 and 2^2 = 4} - 1
  1, 3,     // = 5 - 4, 7 - 4 = {primes between 2^2 = 4 and 3^2 = 9} - 4
  2, 4,      // = 11 - 9, 13 - 9 = {primes between 3^2 = 9 and 4^2 = 16} - 9
  1, 3, 7,    // = 17 - 16, 19 - 16, 23 - 16 = {primes between 16 and 25} - 16
  4, 6,        // = 29 - 25, 31 - 25 = {primes between 5^2 = 25 and 6^2 = 36} - 25
  1, 5, 7, 11,  // = {37, 41, 43, 47: primes between 6^2 = 36 and 7^2 = 49} - 36
  4, 10, 12,    // = {53, 59, 61: primes between 7^2 = 49 and 8^2 = 64} - 49
  3, 7, 9, 15,  // = {67, 71, 73, 79: primes between 8^2 = 64 and 9^2 = 81} - 64
  2, 8, 16,     // = {83, 89, 97: primes between 9^2 = 81 and 10^2 = 100} - 81
  etc. (End)
		

Crossrefs

When written as a table, row lengths are A014085, and row sums are A108314 - A014085 * A000290 = A320688.

Programs

Formula

a(n) = A053186(A000040(n)).
a(n) = A000040(n) - A000006(n)^2. - M. F. Hasler, Oct 04 2009

A065733 Largest square <= n^3.

Original entry on oeis.org

0, 1, 4, 25, 64, 121, 196, 324, 484, 729, 961, 1296, 1681, 2116, 2704, 3364, 4096, 4900, 5776, 6724, 7921, 9216, 10609, 12100, 13689, 15625, 17424, 19600, 21904, 24336, 26896, 29584, 32761, 35721, 39204, 42849, 46656, 50625, 54756, 59049, 63504
Offset: 0

Views

Author

Labos Elemer, Nov 15 2001

Keywords

Examples

			a(10) = 961, as 961 = 31^2 is the largest square <= 1000 = 10^3.
		

Crossrefs

Programs

  • Haskell
    a065733 n = head [x | x <- reverse [0.. n^3], a010052 x == 1] -- Reinhard Zumkeller, Oct 10 2013
  • Mathematica
    Table[Floor[Sqrt[w^3]//N]^2, {w, 1, 50}]
  • PARI
    A065733(n)=sqrtint(n^3)^2  \\ M. F. Hasler, Oct 05 2013
    

Formula

a(n) + A077116(n) = n^3.
a(n) = A048760(n^3).
n^3 - 2*n^(3/2) <= a(n) <= n^3. - Charles R Greathouse IV, Dec 05 2022
a(n) = A000093(n)^2. - Amiram Eldar, Jul 14 2024

A053187 Square nearest to n.

Original entry on oeis.org

0, 1, 1, 4, 4, 4, 4, 9, 9, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16, 16, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
Offset: 0

Views

Author

Henry Bottomley, Mar 01 2000

Keywords

Comments

Apart from 0, k^2 appears 2k times from a(k^2-k+1) through to a(k^2+k) inclusive.

Examples

			a(7) = 9 since 7 is closer to 9 than to 4.
G.f. = x + x^2 + 4*x^3 + 4*x^4 + 4*x^5 + 4*x^6 + 9*x^7 + 9*x^8 + 9*x^9 + ...
		

Crossrefs

Cf. A061023, A201053 (nearest cube), A000290, A000194.

Programs

  • Haskell
    a053187 n = a053187_list !! n
    a053187_list = 0 : concatMap (\x -> replicate (2*x) (x ^ 2)) [1..]
    -- Reinhard Zumkeller, Nov 28 2011
    
  • Maple
    seq(ceil((-1+sqrt(4*n+1))/2)^2, n=0..20); # Robert Israel, Jan 05 2015
  • Mathematica
    nearestSq[n_] := Block[{a = Floor@ Sqrt@ n}, If[a^2 + a + 1/2 > n, a^2, a^2 + 2 a + 1]]; Array[ nearestSq, 75, 0] (* Robert G. Wilson v, Aug 01 2014 *)
  • Python
    from math import isqrt
    def A053187(n): return ((m:=isqrt(n))+int(n>m*(m+1)))**2 # Chai Wah Wu, Jun 06 2025

Formula

a(n) = ceiling((-1 + sqrt(4*n+1))/2)^2. - Robert Israel, Aug 01 2014
G.f.: (1/(1-x))*Sum_{n>=0} (2*n+1)*x^(n^2+n+1). - Robert Israel, Aug 01 2014. This is related to the Jacobi theta-function theta'_1(q), see A002483 and A245552.
G.f.: x / (1-x) * Sum_{k>0} (2*k - 1) * x^(k^2 - k). - Michael Somos, Jan 05 2015
a(n) = floor(sqrt(n)+1/2)^2. - Mikael Aaltonen, Jan 17 2015
Sum_{n>=1} 1/a(n)^2 = 2*zeta(3). - Amiram Eldar, Aug 15 2022
a(n) = A000194(n)^2. - Chai Wah Wu, Jun 06 2025

Extensions

Title improved by Jon E. Schoenfield, Jun 09 2019
Showing 1-10 of 54 results. Next