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-3 of 3 results.

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

Original entry on oeis.org

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, -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, 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
Offset: 0

Views

Author

Henry Bottomley, May 03 2000

Keywords

Examples

			Sqrt(31) is between 5 and 6, and 31 - 6*5 = 1, so a(31)=1.
		

Crossrefs

Cf. A053188.

Programs

  • Maple
    a:= n-> n -(x-> floor(x)*ceil(x))(sqrt(n)):
    seq(a(n), n=0..100);  # Alois P. Heinz, Jan 03 2015
  • Mathematica
    f[n_]:=n-Floor[Sqrt[n]]*Ceiling[Sqrt[n]];Table[f[n],{n,0,5!}] (* Vladimir Joseph Stephan Orlovsky, Mar 29 2010 *)
  • PARI
    a(n)=if(issquare(n),0,my(s=sqrtint(n));n-s^2-s) \\ Charles R Greathouse IV, Feb 07 2013
    
  • Python
    from math import isqrt
    def A038760(n): return m-k if (m:=n-(k:=isqrt(n))**2) else 0 # Chai Wah Wu, Jul 28 2022

Formula

a(n) = n - A000196(n)*A003059(n) = n - A038759(n).

A056942 Area of rectangle needed to enclose a non-touching spiral of length n on a square lattice.

Original entry on oeis.org

0, 1, 2, 4, 6, 6, 9, 12, 12, 12, 16, 20, 20, 20, 20, 25, 30, 30, 30, 30, 30, 36, 42, 42, 42, 42, 42, 42, 49, 56, 56, 56, 56, 56, 56, 56, 64, 72, 72, 72, 72, 72, 72, 72, 72, 81, 90, 90, 90, 90, 90, 90, 90, 90, 90, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 121
Offset: 0

Views

Author

Henry Bottomley, Jul 13 2000

Keywords

Comments

m^2 (when n is m-th triangular number) followed by m copies of m-th pronic [m(m+1)].

Examples

			a(9) = 12 since spiral is as marked by 9 X's in 4*3 = 12 rectangle:
X.XX
X..X
XXXX
		

Crossrefs

Programs

  • Haskell
    a056942 n = a056942_list !! n
    a056942_list = concatMap
                   (\x -> (x ^ 2) : (take x $ repeat (x * (x + 1)))) [0..]
    -- Reinhard Zumkeller, Feb 11 2014
    
  • Mathematica
    ar[n_]:=Module[{c=(Sqrt[8n+1]-1)/2},Floor[c]Ceiling[c]]; Array[ar,70,0] (* Harvey P. Dale, Feb 27 2012 *)
  • Python
    from math import isqrt
    def A056942(n): return (isqrt(n<<3)+1>>1)*((k:=isqrt(m:=n+1<<1))-((m>=k*(k+1)+1)^1)) # Chai Wah Wu, Jun 10 2025

Formula

a(n) = floor[(sqrt(8n+1)-1)/2]*ceiling[(sqrt(8n+1)-1)/2] = A002024(n)*A003056(n) = A056943(n)+n = 2n-A056944(n). If n = t(t+1)/2 then a(n) = t^2; if t(t-1)/2 < n < t(t+1)/2 then a(n) = t(t-1).

A174803 a(n) = n + ceiling(sqrt(n))*floor(sqrt(n)).

Original entry on oeis.org

0, 2, 4, 5, 8, 11, 12, 13, 14, 18, 22, 23, 24, 25, 26, 27, 32, 37, 38, 39, 40, 41, 42, 43, 44, 50, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 72, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 98, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 128, 137
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A000290 (n^2), A001105 (2*n^2).

Programs

  • Mathematica
    f[n_]:=n+Floor[Sqrt[n]]*Ceiling[Sqrt[n]];Table[f[n],{n,0,5!}]

Formula

a(n) = n + A038759(n). - Robert G. Wilson v, Apr 17 2010
a(n^2) = 2*n^2. - Bernard Schott, Jul 30 2022
Showing 1-3 of 3 results.