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.

Previous Showing 11-20 of 25 results. Next

A090029 Number of distinct lines through the origin in 7-dimensional cube of side length n.

Original entry on oeis.org

0, 127, 2059, 16129, 75811, 277495, 804973, 2078455, 4702531, 9905365, 19188793, 35533303, 61846723, 104511583, 168681913, 266042113, 405259513, 607140745, 883046011, 1269174145, 1780715833, 2472697501, 3366818491, 4548464341
Offset: 0

Views

Author

Joshua Zucker, Nov 25 2003

Keywords

Comments

Equivalently, lattice points where the GCD of all coordinates = 1.

Examples

			a(2) = 2059 because the 2059 points with at least one coordinate=2 all make distinct lines and the remaining 127 points and the origin are on those lines.
		

Crossrefs

Cf. A000225, A001047, A060867, A090020, A090021, A090022, A090023, A090024 are for n dimensions with side length 1, 2, 3, 4, 5, 6, 7, 8, respectively. A049691, A090025, A090026, A090027, A090028, A090029 are this sequence for 2, 3, 4, 5, 6, 7 dimensions. A090030 is the table for n dimensions, side length k.

Programs

  • Mathematica
    aux[n_, k_] := If[k == 0, 0, (k + 1)^n - k^n - Sum[aux[n, Divisors[k][[i]]], {i, 1, Length[Divisors[k]] - 1}]];lines[n_, k_] := (k + 1)^n - Sum[Floor[k/i - 1]*aux[n, i], {i, 1, Floor[k/2]}] - 1;Table[lines[7, k], {k, 0, 40}]
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A090029(n):
        if n == 0:
            return 0
        c, j = 1, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += (j2-j)*A090029(k1)
            j, k1 = j2, n//j2
        return (n+1)**7-c+127*(j-n-1) # Chai Wah Wu, Mar 30 2021

Formula

a(n) = A090030(7, n).
a(n) = (n+1)^7 - 1 - Sum_{j=2..n+1} a(floor(n/j)). - Chai Wah Wu, Mar 30 2021

A090030 Triangle read by rows: T(n,k) = number of distinct lines through the origin in the n-dimensional cubic lattice of side length k with one corner at the origin.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 1, 3, 0, 0, 1, 5, 7, 0, 0, 1, 9, 19, 15, 0, 0, 1, 13, 49, 65, 31, 0, 0, 1, 21, 91, 225, 211, 63, 0, 0, 1, 25, 175, 529, 961, 665, 127, 0, 0, 1, 37, 253, 1185, 2851, 3969, 2059, 255, 0, 0, 1, 45, 415, 2065, 7471, 14833, 16129, 6305, 511, 0, 0, 1, 57, 571, 3745, 15541, 45801, 75811, 65025, 19171, 1023, 0
Offset: 0

Views

Author

Joshua Zucker, Nov 24 2003

Keywords

Comments

Equivalently, number of lattice points where the GCD of all coordinates = 1.

Examples

			T(n,1) = 2^n-1 because there are 2^n-1 lattice points other than the corner, all of which make distinct lines. T(n,2) = 3^n - 2^n because if the given corner is the origin, all the points with coordinates in {0,1} make lines that are redundant with a point containing a coordinate 2.
Triangle T(n,k) begins:
  0;
  0, 0;
  0, 1,  0;
  0, 1,  3,   0;
  0, 1,  5,   7,    0;
  0, 1,  9,  19,   15,    0;
  0, 1, 13,  49,   65,   31,     0;
  0, 1, 21,  91,  225,  211,    63,     0;
  0, 1, 25, 175,  529,  961,   665,   127,    0;
  0, 1, 37, 253, 1185, 2851,  3969,  2059,  255,   0;
  0, 1, 45, 415, 2065, 7471, 14833, 16129, 6305, 511, 0;
  ...
		

Crossrefs

Cf. A000225, A001047, A060867, A090020, A090021, A090022, A090023, A090024 give T(n, k) for k = 1, 2, 3, 4, 5, 6, 7, 8, respectively. A049691, A090025, A090026, A090027, A090028, A090029 give T(n, k) for n=2, 3, 4, 5, 6, 7 respectively. A090225 counts only points with at least one coordinate = k.
T(n,n) gives A081474.
Cf. A008683.

Programs

  • Mathematica
    aux[n_, k_] := If[k==0, 0, (k+1)^n-k^n-Sum[aux[n, Divisors[k][[i]]], {i, 1, Length[Divisors[k]]-1}]];lines[n_, k_] := (k+1)^n-Sum[Floor[k/i-1]*aux[n, i], {i, 1, Floor[k/2]}]-1;lines[n, k]

Formula

With A(n, k) = A090225(n, k), T(n, k) =(k+1)^n - 1 - the sum for 0 < i < k of Floor[k/i-1]*A(n, i)
T(n,k) = Sum_{i=1..n-k} moebius(i)*((floor((n-k)/i)+1)^k-1). - Vladeta Jovovic, Dec 03 2004

A090021 Number of distinct lines through the origin in the n-dimensional lattice of side length 5.

Original entry on oeis.org

0, 1, 21, 175, 1185, 7471, 45801, 277495, 1672545, 10056991, 60405081, 362615815, 2176242705, 13059083311, 78359348361, 470170570135, 2821066729665, 16926530042431, 101559568723641, 609358576700455, 3656154951181425
Offset: 0

Views

Author

Joshua Zucker, Nov 19 2003

Keywords

Comments

Equivalently, lattice points where the gcd of all the coordinates is 1.

Examples

			a(2) = 21 because in 2D the lines have slope 0, 1/5, 2/5, 3/5, 4/5, 1/4, 3/4, 1/3, 2/3, 1/2, 1 and their reciprocals.
		

Crossrefs

a(n) = T(n, 5) from A090030. Cf. A000225, A001047, A060867, A090020, A090022, A090023, A090024 are for dimension n with side lengths 1, 2, 3, 4, 6, 7, 8 respectively. A049691, A090025, A090026, A090027, A090028, A090029 are for side length k in 2, 3, 4, 5, 6, 7 dimensions.

Programs

  • Mathematica
    Table[6^n - 3^n - 2*2^n + 2, {n, 0, 25}]
    LinearRecurrence[{12,-47,72,-36},{0,1,21,175},30] (* Harvey P. Dale, Jul 18 2016 *)

Formula

a(n) = 6^n - 3^n - 2*2^n + 2.
G.f.: -x*(30*x^2-9*x-1)/((x-1)*(2*x-1)*(3*x-1)*(6*x-1)). [Colin Barker, Sep 04 2012]

A090023 Number of distinct lines through the origin in the n-dimensional lattice of side length 7.

Original entry on oeis.org

0, 1, 37, 415, 3745, 31471, 257257, 2078455, 16704865, 133935391, 1072633177, 8585561095, 68702163985, 549687102511, 4397773276297, 35183283965335, 281470638631105, 2251782504544831, 18014329402322617, 144114912035163175, 1152920401607386225
Offset: 0

Views

Author

Joshua Zucker, Nov 20 2003

Keywords

Comments

Equivalently, lattice points where the gcd of all the coordinates is 1.

Examples

			a(2) = 37 because in 2D the lines have slope 0, 1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 1/6, 5/6, 1/5, 2/5, 3/5, 4/5, 1/4, 3/4, 1/3, 2/3, 1/2, 1 and their reciprocals.
		

Crossrefs

Equals A090030(n+7,n).
Cf. A000225, A001047, A060867, A090020, A090021, A090022, A090024 are for dimension n with side lengths 1, 2, 3, 4, 5, 6, 8 respectively. A049691, A090025, A090026, A090027, A090028, A090029 are for side length k in 2, 3, 4, 5, 6, 7 dimensions.

Programs

  • Mathematica
    Table[8^n - 4^n - 3^n - 2^n + 2, {n, 0, 20}]
  • Python
    [8**n-4**n-3**n-2**n+2 for n in range(25)] # Gennady Eremin, Mar 09 2022

Formula

a(n) = 8^n - 4^n - 3^n - 2^n + 2.
G.f.: -x*(200*x^3-136*x^2+19*x+1)/((x-1)*(2*x-1)*(3*x-1)*(4*x-1)*(8*x-1)). - Colin Barker, Sep 04 2012

A206297 Position of n in the canonical bijection from the positive integers to the positive rational numbers.

Original entry on oeis.org

1, 3, 5, 9, 13, 21, 25, 37, 45, 57, 65, 85, 93, 117, 129, 145, 161, 193, 205, 241, 257, 281, 301, 345, 361, 401, 425, 461, 485, 541, 557, 617, 649, 689, 721, 769, 793, 865, 901, 949, 981, 1061, 1085, 1169, 1209, 1257, 1301, 1393, 1425, 1509, 1549
Offset: 1

Views

Author

Clark Kimberling, Feb 06 2012

Keywords

Comments

The canonical bijection from the positive integers to the positive rational numbers is given by A038568(n)/A038569(n).
Appears to be a variant of A049691. - R. J. Mathar, Feb 11 2012
It appears that a(n) = 2*A005728(n) - 1. - Chris Boyd, Mar 21 2015

Examples

			The canonical bijection starts with 1/1, 1/2, 2/1, 1/3, 3/1, 2/3, 3/2, 1/4, 4/1, 3/4, 4/3, 1/5, 5/1, so that this sequence starts with 1,3,5,9,13 and A206350 starts with 1,2,4,8,12.
		

Crossrefs

A049691 is an essentially identical sequence. See also A018805.

Programs

  • Mathematica
    a[n_] := Module[{s = 1, k = 2, j = 1},
      While[s <= n, s = s + 2*EulerPhi[k]; k = k + 1];
      s = s - 2*EulerPhi[k - 1];
      While[s <= n, If[GCD[j, k - 1] =
        = 1, s = s + 2]; j = j + 1];
      If[s > n + 1, j - 1, k - 1]];
    t = Table[a[n], {n, 0, 3000}];   (* A038568 *)
    ReplacePart[1 + Flatten[Position[t, 1]], 1, 1]
    (* A206297 *)
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A206297(n):
        if n == 1:
            return 1
        c, j = 1, 2
        k1 = (n-1)//j
        while k1 > 1:
            j2 = (n-1)//k1 + 1
            c += (j2-j)*(A206297(k1+1)-2)
            j, k1 = j2, (n-1)//j2
        return (n-2)*(n-1)-c+j+2 # Chai Wah Wu, Aug 04 2024

A300778 Number of grid points visible from a corner of an m X n rectangular region on a square grid written as triangle T(m,n), 1 <= n <= m.

Original entry on oeis.org

3, 4, 5, 5, 7, 9, 6, 8, 11, 13, 7, 10, 14, 17, 21, 8, 11, 15, 18, 23, 25, 9, 13, 18, 22, 28, 31, 37, 10, 14, 20, 24, 31, 34, 41, 45, 11, 16, 22, 27, 35, 38, 46, 51, 57, 12, 17, 24, 29, 37, 40, 49, 54, 61, 65, 13, 19, 27, 33, 42, 46, 56, 62, 70, 75, 85
Offset: 1

Views

Author

Hugo Pfoertner, Mar 12 2018

Keywords

Comments

Same as A049687, but written as triangle.

Examples

			The triangle starts:
  3
  4   5
  5   7   9
  6   8  11  13
  7  10  14  17  21
  8  11  15  18  23  25
  9  13  18  22  28  31  37
  ...
T(3,2) = 7, X indicating hidden grid points:
  0-----1#####X#####X
  |     |     |     |
  |     |     |     |
  2-----3-----4-----5
  #     | #   |     |
  #     |   # |     |
  X-----6-----X-----7
		

Crossrefs

Cf. A049687, A049691 (diagonal of triangle).

A339400 Mark each point on the n X n grid with the number of points that are visible from it; a(n) is the number of distinct values in the grid.

Original entry on oeis.org

1, 3, 3, 4, 3, 7, 5, 7, 7, 11, 5, 14, 8, 13, 13, 19, 9, 22, 11, 23, 21, 25, 13, 29, 21, 34, 26, 37, 11, 40, 26, 44, 31, 45, 21, 54, 35, 54, 36, 55, 24, 65, 40, 59, 47, 70, 24, 71, 43, 72, 55, 81, 28, 74, 55, 88, 59, 90, 28, 93, 58, 91, 66, 96, 46, 110, 63, 100
Offset: 1

Views

Author

Torlach Rush, Dec 02 2020

Keywords

Comments

a(n) <= A008805(n). This is because A008805(n) is the maximum number of points required to calculate a(n) and each point is located in the first quadrant.

Examples

			a(1) = 1 because there are 3 visible points from every point on the grid.
a(2) = 3 because 5 points are visible from every vertex of the grid, 7 points are visible from the midpoint of every edge of the grid, and 8 points are visible from the middle of the grid.
a(3) = 3 because 9 points are visible from every vertex of the grid, 11 points are visible from the inner points of every edge of the grid, and 12 points are visible from every inner point of the grid.
		

Crossrefs

Programs

  • PARI
    \\ n = side length, d = dimension
    cdvps(n, d) ={my(m=Map());
      forvec(u=vector(d, i, [0, n\2]),
        my(c=0); forvec(v=[[t-n, t]|t<-u], c+=(gcd(v)==1));
        mapput(m, c, 1), 1);
      #m; }
    a(n) = cdvps(n, 2)

A081474 Number of distinct lines through the origin in n-dimensional cube of side length n.

Original entry on oeis.org

0, 1, 5, 49, 529, 7471, 112825, 2078455, 42649281, 997784221, 25875851825, 742641202183, 23283999690561, 793616663524231, 29188521870580929, 1152885848976064513, 48659336030073207425, 2185894865613157551481, 104126348669497256201905, 5242869988601103651841105
Offset: 0

Views

Author

Joshua Zucker, Nov 25 2003

Keywords

Comments

Equivalently, lattice points where the GCD of all coordinates = 1.

Examples

			a(3) = 49 because in the 3-dimensional lattice of side length 3, the lines through the origin are determined by all 37 points with at least one coordinate = 3 and 6 permutations of (2,1,0) and 3 permutations each of (2,1,1) and (2,2,1).
		

Crossrefs

Cf. A000225, A001047, A060867, A090020, A090021, A090022, A090023, A090024 are for n dimensions with side length 1, 2, 3, 4, 5, 6, 7, 8, respectively. A049691, A090025, A090026, A090027, A090028, A090029 are this sequence for 2, 3, 4, 5, 6, 7 dimensions. A090030 is the table for n dimensions, side length k.

Programs

  • Maple
    a:= n-> add(numtheory[mobius](i)*((floor(n/i)+1)^n-1), i=1..n):
    seq(a(n), n=0..20);  # Alois P. Heinz, Mar 09 2022
  • Mathematica
    aux[n_, k_] := If[k == 0, 0, (k + 1)^n - k^n - Sum[aux[n, Divisors[k][[i]]], {i, 1, Length[Divisors[k]] - 1}]];lines[n_, k_] := (k + 1)^n - Sum[Floor[k/i - 1]*aux[n, i], {i, 1, Floor[k/2]}] - 1;Table[lines[k, k], {k, 0, 20}]

Formula

a(n) = A090030(n,n).

A324796 Irregular triangle read by rows: row n gives numerators of fractions in the Farey subsequence B(m).

Original entry on oeis.org

0, 1, 1, 0, 1, 1, 2, 1, 0, 1, 1, 2, 1, 3, 2, 3, 1, 0, 1, 1, 1, 2, 3, 1, 4, 3, 2, 3, 4, 1, 0, 1, 1, 1, 2, 1, 3, 2, 3, 4, 1, 5, 4, 3, 5, 2, 5, 3, 4, 5, 1, 0, 1, 1, 1, 1, 2, 1, 3, 2, 3, 4, 5, 1, 6, 5, 4, 3, 5, 2, 5, 3, 4, 5, 6, 1, 0, 1, 1, 1, 1, 2, 1, 2, 3, 1, 4, 3, 2, 5, 3, 4, 5, 6, 1, 7, 6, 5, 4, 7, 3, 5, 7, 2, 7, 5, 3, 7, 4, 5, 6, 7, 1
Offset: 1

Views

Author

N. J. A. Sloane, Sep 10 2019

Keywords

Comments

B(n) is denoted by F(B(2n),n) in Matveev (2017) - see definition on page 1. B(n) consists of the terms h/k of the Farey series F_{2n} such that k-n <= h <= n.
A049691 gives the row lengths.

Examples

			The first few sequences B(1), B(2), B(3), B(4) are:
[0, 1/2, 1],
[0, 1/3, 1/2, 2/3, 1],
[0, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 1],
[0, 1/5, 1/4, 1/3, 2/5, 3/7, 1/2, 4/7, 3/5, 2/3, 3/4, 4/5, 1], [0, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 4/9, 1/2, 5/9, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 1],
...
		

References

  • A. O. Matveev, Farey Sequences, De Gruyter, 2017.

Crossrefs

Cf. A006842/A006843, A049691, A324797 (denominators).

Programs

  • Maple
    Farey := proc(n) sort(convert(`union`({0}, {seq(seq(m/k, m=1..k), k=1..n)}), list)) end:
    B := proc(m) local a,i,h,k; global Farey; a:=[];
    for i in Farey(2*m) do
    h:=numer(i); k:=denom(i);
    if (h <= m) and (k-m <= h) then a:=[op(a),i]; fi; od: a; end;

A324797 Irregular triangle read by rows: row n gives denominators of fractions in the Farey subsequence B(m).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 10 2019

Keywords

Comments

B(n) is denoted by F(B(2n),n) in Matveev (2017) - see definition on page 1. B(n) consists of the terms h/k of the Farey series F_{2n} such that k-n <= h <= n.
A049691 gives the row lengths.

Examples

			The first few sequences B(1), B(2), B(3), B(4) are:
[0, 1/2, 1],
[0, 1/3, 1/2, 2/3, 1],
[0, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 1],
[0, 1/5, 1/4, 1/3, 2/5, 3/7, 1/2, 4/7, 3/5, 2/3, 3/4, 4/5, 1], [0, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 4/9, 1/2, 5/9, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 1],
...
		

References

  • A. O. Matveev, Farey Sequences, De Gruyter, 2017.

Crossrefs

Cf. A006842/A006843, A049691, A324796 (numerators).

Programs

  • Maple
    Farey := proc(n) sort(convert(`union`({0}, {seq(seq(m/k, m=1..k), k=1..n)}), list)) end:
    B := proc(m) local a,i,h,k; global Farey; a:=[];
    for i in Farey(2*m) do
    h:=numer(i); k:=denom(i);
    if (h <= m) and (k-m <= h) then a:=[op(a),i]; fi; od: a; end;
Previous Showing 11-20 of 25 results. Next