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.

A358298 Array read by antidiagonals: T(n,k) (n>=0, k>=0) = number of lines defining the Farey diagram Farey(n,k) of order (n,k).

Original entry on oeis.org

2, 3, 3, 4, 6, 4, 6, 11, 11, 6, 8, 19, 20, 19, 8, 12, 29, 36, 36, 29, 12, 14, 43, 52, 60, 52, 43, 14, 20, 57, 78, 88, 88, 78, 57, 20, 24, 77, 100, 128, 124, 128, 100, 77, 24, 30, 97, 136, 162, 180, 180, 162, 136, 97, 30, 34, 121, 166, 216, 224, 252, 224, 216, 166, 121, 34
Offset: 0

Views

Author

Keywords

Comments

We work with lines with equation ux + vy + w = 0 in the (x,y) plane.
This line has slope -u/v, and crosses the vertical y axis at the intercept point y = -w/v
For the Farey diagram Farey(m,n), u is an integer between -(m-1) and +(m-1), v is between -(n-1) and +(n-1) and w can be any integer.
The only lines that are used are those that hit the unit square 0 <= x <= 1, 0 <= y <= 1 in at least two points.
This means that we only need to look at w's with |w| <= |u| + |v|.
T(m,n) is the number of such lines.
For illustrations of Farey(3,3) and Farey(3,4) see Khoshnoudirad (2015), Fig. 2, and Darat et al. (2009), Fig. 2. For further illustrations see A358882-A358885.

Examples

			The full array T(n,k), n >= 0, k>= 0, begins:
  2, 3, 4, 6, 8, 12, 14, 20, 24, 30, 34, 44, 48, 60,  ...
  3, 6, 11, 19, 29, 43, 57, 77, 97, 121, 145, 177, 205,  ...
  4, 11, 20, 36, 52, 78, 100, 136, 166, 210, 246, 302,  ...
  6, 19, 36, 60, 88, 128, 162, 216, 266, 326, 386, 468, ...
  8, 29, 52, 88, 124, 180, 224, 298, 360, 444, 518, 628, ...
  12, 43, 78, 128, 180, 252, 316, 412, 498, 608, 706,  ...
  14, 57, 100, 162, 224, 316, 388, 508, 608, 738, 852, ...
  ...
		

Crossrefs

Cf. A358299.
Row 0 is essentially A225531, row 1 is A358300, main diagonal is A358301.
The Farey Diagrams Farey(m,n) are studied in A358298-A358307 and A358882-A358885, the Completed Farey Diagrams of order (m,n) in A358886-A358889.

Programs

  • Maple
    A005728 := proc(n) 1+add(numtheory[phi](i), i=1..n) ; end proc: # called F_n in the paper
    Amn:=proc(m,n) local a,i,j;  # A331781 or equally A333295. Diagonal is A018805.
    a:=0; for i from 1 to m do for j from 1 to n do
    if igcd(i,j)=1 then a:=a+1; fi; od: od: a; end;
    # The present sequence is:
    Dmn:=proc(m,n) local d,t1,u,v,a; global A005728, Amn;
    a:=A005728(m)+A005728(n);
    t1:=0; for u from 1 to m do for v from 1 to n do
    d:=igcd(u,v); if d>=1 then t1:=t1 + (u+v)*numtheory[phi](d)/d; fi; od: od:
    a+2*t1-2*Amn(m,n); end;
    for m from 1 to 8 do lprint([seq(Dmn(m,n),n=1..20)]); od:
  • Mathematica
    A005728[n_] := 1 + Sum[EulerPhi[i], {i, 1, n}];
    Amn[m_, n_] := Module[{a, i, j}, a = 0; For[i = 1, i <= m, i++, For[j = 1, j <= n, j++, If[GCD[i, j] == 1, a = a + 1]]]; a];
    Dmn[m_, n_] := Module[{d, t1, u, v, a}, a = A005728[m] + A005728[n]; t1 = 0; For[u = 1, u <= m, u++, For[v = 1, v <= n, v++, d = GCD[u, v]; If[d >= 1 , t1 = t1 + (u + v)* EulerPhi[d]/d]]]; a + 2*t1 - 2*Amn[m, n]];
    Table[Dmn[m - n, n], {m, 0, 10}, {n, 0, m}] // Flatten (* Jean-François Alcover, Apr 03 2023, after Maple code *)

A100449 Number of ordered pairs (i,j) with |i| + |j| <= n and gcd(i,j) <= 1.

Original entry on oeis.org

1, 5, 9, 17, 25, 41, 49, 73, 89, 113, 129, 169, 185, 233, 257, 289, 321, 385, 409, 481, 513, 561, 601, 689, 721, 801, 849, 921, 969, 1081, 1113, 1233, 1297, 1377, 1441, 1537, 1585, 1729, 1801, 1897, 1961, 2121, 2169, 2337, 2417, 2513, 2601, 2785, 2849, 3017
Offset: 0

Views

Author

N. J. A. Sloane, Nov 21 2004

Keywords

Comments

Note that gcd(0,m) = m for any m.
I would also like to get the sequences of the numbers of distinct sums i+j (also distinct products i*j) over all ordered pairs (i,j) with |i| + |j| <= n; also over all ordered pairs (i,j) with |i| + |j| <= n and gcd(i,j) <= 1.
From Robert Price, May 10 2013: (Start)
List of sequences that address these extensions:
Distinct sums i+j with or without the GCD qualifier results in a(n)=2n+1 (A005408).
Distinct products i*j without the GCD qualifier is given by A225523.
Distinct products i*j with the GCD qualifier is given by A225526.
With the restriction i,j >= 0 ...
Distinct sums or products equal to n is trivial and always equals one (A000012).
Distinct sums <=n with or without the GCD qualifier results in a(n)=n (A001477).
Distinct products <=n without the GCD qualifier is given by A225527.
Distinct products <=n with the GCD qualifier is given by A225529.
Ordered pairs with the sum = n without the GCD qualifier is a(n)=n+1.
Ordered pairs with the sum = n with the GCD qualifier is A225530.
Ordered pairs with the sum <=n without the GCD qualifier is A000217(n+1).
Ordered pairs with the sum <=n with the GCD qualifier is A225531.
(End)
This sequence (A100449) without the GCD qualifier results in A001844. - Robert Price, Jun 04 2013

Crossrefs

Programs

  • Maple
    f:=proc(n) local i,j,k,t1,t2,t3; t1:=0; for i from -n to n do for j from -n to n do if abs(i) + abs(j) <= n then t2:=gcd(i,j); if t2 <= 1 then t1:=t1+1; fi; fi; od: od: t1; end;
    # second Maple program:
    b:= proc(n) b(n):= numtheory[phi](n)+`if`(n=0, 0, b(n-1)) end:
    a:= n-> 1+4*b(n):
    seq(a(n), n=0..50);  # Alois P. Heinz, Mar 01 2013
  • Mathematica
    f[n_] := Length[ Union[ Flatten[ Table[ If[ Abs[i] + Abs[j] <= n && GCD[i, j] <= 1, {i, j}, {0, 0}], {i, -n, n}, {j, -n, n}], 1]]]; Table[ f[n], {n, 0, 49}] (* Robert G. Wilson v, Dec 14 2004 *)
  • PARI
    a(n) = 1+4*sum(k=1, n, eulerphi(k) ); \\ Joerg Arndt, May 10 2013
    
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A100449(n):
        if n == 0:
            return 1
        c, j = 0, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += (j2-j)*((A100449(k1)-3)//2)
            j, k1 = j2, n//j2
        return 2*(n*(n-1)-c+j)+1 # Chai Wah Wu, Mar 29 2021

Formula

a(n) = 1 + 4*Sum(phi(k), k=1..n) = 1 + 4*A002088(n). - Vladeta Jovovic, Nov 25 2004

Extensions

More terms from Vladeta Jovovic, Nov 25 2004

A049628 a(n) = Sum_{i=0..n} T(i,n-i) where T is A049627.

Original entry on oeis.org

1, 4, 8, 14, 22, 34, 48, 68, 92, 122, 156, 200, 248, 308, 374, 448, 530, 628, 732, 854, 984, 1126, 1278, 1452, 1634, 1836, 2050, 2282, 2526, 2798, 3078, 3388, 3714, 4060, 4422, 4808, 5206, 5640, 6092, 6568, 7060, 7592, 8136, 8722, 9328, 9958, 10610, 11308
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A049627.
Partial sums of A225531.

Programs

  • PARI
    T(n,k) = (n+1)*(k+1) - sum(i=0, n, sum(j=0, k, gcd(i,j)>1)); \\ A049627
    a(n) = sum(i=0, n, T(i,n-i)); \\ Michel Marcus, Aug 06 2021

Extensions

More terms from Sean A. Irvine, Aug 05 2021
Showing 1-3 of 3 results.