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

A101688 Once 1, once 0, repeat, twice 1, twice 0, repeat, thrice 1, thrice 0, ... and so on.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1
Offset: 0

Views

Author

Ralf Stephan, Dec 19 2004

Keywords

Comments

The definition is that of a linear sequence. Equivalently, define a (0,1) infinite lower triangular matrix T(n,k) (0 <= k <= n) by T(n,k) = 1 if k >= n/2, 0 otherwise, and read it by rows. The triangle T begins:
1
0 1
0 1 1
0 0 1 1
0 0 1 1 1
0 0 0 1 1 1
... The matrix T is used in A168508. [Comment revised by N. J. A. Sloane, Dec 05 2020]
Also, square array A read by antidiagonals upwards: A(n,k) = 1 if k >= n, 0 otherwise.
For n >= 1, T(n,k) = number of partitions of n into k parts of sizes 1 or 2. - Nicolae Boicu, Aug 23 2018
T(n, k) is the number of ways to distribute n balls to k unlabeled urns in such a way that no urn receives more than one ball (see Beeler). - Stefano Spezia, Jun 16 2023

Examples

			The array A (on the left) and the triangle T of its antidiagonals (on the right):
  1 1 1 1 1 1 1 1 1 ......... 1
  0 1 1 1 1 1 1 1 1 ........ 0 1
  0 0 1 1 1 1 1 1 1 ....... 0 1 1
  0 0 0 1 1 1 1 1 1 ...... 0 0 1 1
  0 0 0 0 1 1 1 1 1 ..... 0 0 1 1 1
  0 0 0 0 0 1 1 1 1 .... 0 0 0 1 1 1
  0 0 0 0 0 0 1 1 1 ... 0 0 0 1 1 1 1
  0 0 0 0 0 0 0 1 1 .. 0 0 0 0 1 1 1 1
  0 0 0 0 0 0 0 0 1 . 0 0 0 0 1 1 1 1 1
		

References

  • Robert A. Beeler, How to Count: An Introduction to Combinatorics and Its Applications, Springer International Publishing, 2015. See Proposition 4.2.1 at p. 98.

Crossrefs

Row sums of T (and antidiagonal sums of A) are A008619.

Programs

  • Mathematica
    rows = 15; A = Array[If[#1 <= #2, 1, 0]&, {rows, rows}]; Table[A[[i-j+1, j]], {i, 1, rows}, {j, 1, i}] // Flatten (* Jean-François Alcover, May 04 2017 *)
  • Python
    from math import isqrt
    def A101688(n): return isqrt((m:=n<<1)+1)-(isqrt((m<<2)+8)+1>>1)+1 # Chai Wah Wu, Feb 10 2023

Formula

G.f.: 1/((1 - x*y)*(1 - y)).
G.f. of k-th row of the array: x^(k-1)/(1 - x).
T(n, k) = 1 if binomial(k, n-k) > 0, otherwise 0. - Paul Barry, Aug 23 2005
From Boris Putievskiy, Jan 09 2013: (Start)
a(n) = floor((2*A002260(n)+1)/A003056(n)+3).
a(n) = floor((2*n-t*(t+1)+1)/(t+3)), where
t = floor((-1+sqrt(8*n-7))/2). (End)
a(n) = floor(sqrt(2*n+1)) - floor(sqrt(2*n+1) - 1/2). - Ridouane Oudra, Jul 16 2020
a(n) = A103128(n+1) - A003056(n). - Ridouane Oudra, Apr 09 2022
E.g.f. of k-th column of the array: exp(x)*Gamma(1+k, x)/k!. - Stefano Spezia, Jun 16 2023

Extensions

Edited by N. J. A. Sloane, Dec 05 2020

A172471 a(n) = floor(sqrt(2*n)).

Original entry on oeis.org

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

Views

Author

Vincenzo Librandi, Feb 04 2010

Keywords

Comments

If k is even, k appears k+1 times; if k is odd, k appears k times. - N. J. A. Sloane, Jan 25 2021

Crossrefs

Programs

  • Haskell
    a172471 = a000196 . (* 2)  -- Reinhard Zumkeller, Feb 12 2012
    
  • Magma
    [Floor(Sqrt(2*n)) : n in [0..80]];
    
  • Mathematica
    Table[Floor[Sqrt[2n]],{n,0,80}]
  • PARI
    a(n) = sqrtint(2*n); \\ Michel Marcus, May 23 2025

Formula

a(n) = A000196(2*n). - R. J. Mathar, Jul 06 2010

A176615 Number of edges in the graph on n vertices, labeled 1 to n, where two vertices are joined just if their labels sum to a perfect square.

Original entry on oeis.org

0, 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 49, 52, 55, 57, 59, 61, 63, 65, 68, 71, 74, 77, 80, 83, 86, 89, 91, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 127, 131, 135, 138, 141, 144, 147, 150
Offset: 1

Views

Author

Keywords

Comments

Equivalently, number of pairs of integers 0 < i < j <= n such that i + j is a square.
Suggested by R. K. Guy

Examples

			For n = 7 the graph contains the 4 edges 1-3, 2-7, 3-6, 4-5.
		

Crossrefs

Column k=2 of A281871.

Programs

  • Maple
    b:= n-> 1+floor(sqrt(2*n-1))-ceil(sqrt(n+1)):
    a:= proc(n) option remember; `if`(n=0, 0, a(n-1)+b(n)) end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Jan 30 2017
  • Mathematica
    a[n_] := Sum[Floor[Sqrt[2k-1]] - Floor[Sqrt[k]], {k, 1, n}]; Table[a[n], {n, 1, 68}] (* Jean-François Alcover, Nov 04 2011, after Pari *)
  • PARI
    a(n)=sum(k=1,sqrtint(n+1),ceil(k^2/2)-1)+sum(k=sqrtint(n+1)+1,sqrtint(2*n -1),n-floor(k^2/2))
    
  • PARI
    a(n)=sum(k=1,n,sqrtint(2*k-1)-sqrtint(k))

Formula

Asymptotically, a(n) ~ (2*sqrt(2) - 2)/3 n^(3/2). The error term is probably O(n^(1/2)); O(n) is easily provable.

A273190 a(n) is the number of nonnegative m < n for which m + n is a perfect square.

Original entry on oeis.org

0, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4
Offset: 0

Views

Author

Alec Jones, May 17 2016

Keywords

Examples

			a(1) = 1 because 1 + 0 is a perfect square.
a(2) = 0 because neither 2 + 0 nor 2 + 1 are perfect squares.
a(5) = 1 because 5 + 4 is a perfect square.
a(9) = 2 because 9 + 0 and 9 + 7 are perfect squares.
		

Crossrefs

Programs

  • Haskell
    a273190 n = length $ filter (>=n) $ takeWhile (< 2 * n) $ map (^2) [1..] -- Peter Kagey, May 25 2016
    
  • Java
    int n = 100;
    int[] terms = new int[n];
    for (int i = 0; i < n; i++) {
         for (int j = 0; j < i; j++) {
              if (Math.sqrt(i+j) == Math.floor(Math.sqrt(i+j))) {
                   terms[i]++;
              }
         }
         System.out.print(terms[i] + ", ");
    }
    
  • Mathematica
    Table[Count[Range[0, n - 1], m_ /; IntegerQ@ Sqrt[m + n]], {n, 0, 120}] (* Michael De Vlieger, May 18 2016 *)
  • PARI
    a(n) = sum(k=0, n-1, issquare(n+k)); \\ Michel Marcus, May 18 2016
    
  • Python
    from gmpy2 import isqrt
    def A273190(n):
        return isqrt(2*n-1)-isqrt(n-1) if n > 0 else 0 # Chai Wah Wu, May 25 2016

Formula

a(n) = floor(sqrt(2*n-1))-floor(sqrt(n-1)) for n > 0. - Chai Wah Wu, May 25 2016
a(n) = A103128(n) - A000196(n-1); after previous formula. - Michel Marcus, May 25 2016
a(n) = Sum_{i=1..n} c(2*n-i), where c is the square characteristic (A010052). - Wesley Ivan Hurt, Nov 26 2020

A333574 Number of Hamiltonian paths in the n X 2 grid graph which start at any of the n vertices on left side of the graph and terminate at any of the n vertices on the right side.

Original entry on oeis.org

1, 2, 4, 6, 10, 14, 20, 26, 34, 42, 52, 62, 74, 86, 100, 114, 130, 146, 164, 182, 202, 222, 244, 266, 290, 314, 340, 366, 394, 422, 452, 482, 514, 546, 580, 614, 650, 686, 724, 762, 802, 842, 884, 926, 970, 1014, 1060, 1106, 1154, 1202, 1252, 1302, 1354, 1406, 1460
Offset: 1

Views

Author

Seiichi Manyama, Mar 27 2020

Keywords

Comments

Conjecture: Numbers k such that A339399(k) = A103128(k). - Wesley Ivan Hurt, Nov 19 2021

Examples

			a(1) = 1;
   +--+
a(2) = 2;
   +  +   *--*
   |  |   |  |
   *--*   +  +
a(3) = 4;
   +  +   +--*   *--+   *--*
   |  |      |   |      |  |
   *  *   *--*   *--*   *  *
   |  |   |         |   |  |
   *--*   *--+   +--*   +  +
		

Crossrefs

Column k=2 of A333571.
Cf. A333510.

Programs

  • PARI
    N=66; x='x+O('x^N); Vec(x*(1+2*x*(1-x^2+x^3)/((1+x)*(1-x)^3)))
    
  • Python
    # Using graphillion
    from graphillion import GraphSet
    import graphillion.tutorial as tl
    def A(start, goal, n, k):
        universe = tl.grid(n - 1, k - 1)
        GraphSet.set_universe(universe)
        paths = GraphSet.paths(start, goal, is_hamilton=True)
        return paths.len()
    def A333571(n, k):
        if n == 1: return 1
        s = 0
        for i in range(1, n + 1):
            for j in range(k * n - n + 1, k * n + 1):
                s += A(i, j, k, n)
        return s
    def A333574(n):
        return A333571(n, 2)
    print([A333574(n) for n in range(1, 25)])

Formula

G.f.: x*(1+2*x*(1-x^2+x^3)/((1+x)*(1-x)^3)).
From Colin Barker, Mar 27 2020: (Start)
a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n>5.
a(n) = (9 + (-1)^(1+n) - 4*n + 2*n^2) / 4 for n>1. (End)
E.g.f.: ((4 - x + x^2)*cosh(x) + (5 - x + x^2)*sinh(x) - 2*(2 + x))/2. - Stefano Spezia, Jun 14 2023

A183572 a(n) = n + floor(sqrt(2*n-1)).

Original entry on oeis.org

2, 3, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92
Offset: 1

Views

Author

Clark Kimberling, Jan 05 2011

Keywords

Crossrefs

Cf. A074148 (complement), A103128.

Programs

A183573 a(n) = n + floor(sqrt(2n+1)).

Original entry on oeis.org

2, 4, 5, 7, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91, 92
Offset: 1

Views

Author

Clark Kimberling, Jan 05 2011

Keywords

Crossrefs

Cf. A047838, A103128, A116940 (complement).

Programs

  • Maple
    seq(n+floor(sqrt(2*n+1)), n=1..100); # Robert Israel, Sep 12 2016
  • Mathematica
    Table[n + Floor@ Sqrt[2 n + 1], {n, 80}] (* Michael De Vlieger, Sep 12 2016 *)

Formula

From Robert Israel, Sep 12 2016: (Start)
a(n+1)=a(n)+2 if n is in A047838, otherwise a(n+1) = a(n)+1.
a(n) = n + A103128(n+1).
G.f.: Theta3(x^2)/(2*(1-x)) + Theta2(x^2)/(2*sqrt(x)*(1-x)) - (1-2*x)*(3-x)/(2*(1-x)^2), where Theta2 and Theta3 are Jacobi Theta functions. (End)

A337134 a(n) = Sum_{k=1..n} floor(sqrt(2k-1)).

Original entry on oeis.org

1, 2, 4, 6, 9, 12, 15, 18, 22, 26, 30, 34, 39, 44, 49, 54, 59, 64, 70, 76, 82, 88, 94, 100, 107, 114, 121, 128, 135, 142, 149, 156, 164, 172, 180, 188, 196, 204, 212, 220, 229, 238, 247, 256, 265, 274, 283, 292, 301, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 421, 432
Offset: 1

Views

Author

Wesley Ivan Hurt, Aug 18 2020

Keywords

Comments

Partial sums of A103128.

Crossrefs

Cf. A103128.

Programs

  • Mathematica
    Table[Sum[Floor[Sqrt[2 i - 1]], {i, n}], {n, 100}]
  • PARI
    a(n) = sum(k=1, n, sqrtint(2*k-1)); \\ Michel Marcus, Aug 18 2020

A349489 a(n) = Sum_{k=1..n} k * floor(sqrt(2*k-1)).

Original entry on oeis.org

1, 3, 9, 17, 32, 50, 71, 95, 131, 171, 215, 263, 328, 398, 473, 553, 638, 728, 842, 962, 1088, 1220, 1358, 1502, 1677, 1859, 2048, 2244, 2447, 2657, 2874, 3098, 3362, 3634, 3914, 4202, 4498, 4802, 5114, 5434, 5803, 6181, 6568, 6964, 7369, 7783, 8206, 8638, 9079, 9529, 10039
Offset: 1

Views

Author

Wesley Ivan Hurt, Nov 19 2021

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Sum[k*Floor[Sqrt[2 k - 1]], {k, n}], {n, 80}]
Showing 1-9 of 9 results.