A018805
Number of elements in the set {(x,y): 1 <= x,y <= n, gcd(x,y)=1}.
Original entry on oeis.org
1, 3, 7, 11, 19, 23, 35, 43, 55, 63, 83, 91, 115, 127, 143, 159, 191, 203, 239, 255, 279, 299, 343, 359, 399, 423, 459, 483, 539, 555, 615, 647, 687, 719, 767, 791, 863, 899, 947, 979, 1059, 1083, 1167, 1207, 1255, 1299, 1391, 1423, 1507, 1547, 1611, 1659, 1763
Offset: 1
- S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 110-112.
- G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954. See Theorem 332.
- Olivier Gérard, Table of n, a(n) for n = 1..100000 [Replaces an earlier b-file from Charles R Greathouse IV]
- Jin-Yi Cai and Eric Bach, On testing for zero polynomials by a set of points with bounded precision, Theoret. Comput. Sci. 296 (2003), no. 1, 15-25. MR1965515 (2004m:68279).
- Pieter Moree, Counting carefree couples, arXiv:math/0510003 [math.NT], 2005-2014.
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
- Eric Weisstein's World of Mathematics, Carefree Couple
-
a018805 n = length [()| x <- [1..n], y <- [1..n], gcd x y == 1]
-- Reinhard Zumkeller, Jan 21 2013
-
/* based on the first formula */ A018805:=func< n | 2*&+[ EulerPhi(k): k in [1..n] ]-1 >; [ A018805(n): n in [1..60] ]; // Klaus Brockhaus, Jan 27 2011
-
/* based on the second formula */ A018805:=func< n | n eq 1 select 1 else n^2-&+[ $$(n div j): j in [2..n] ] >; [ A018805(n): n in [1..60] ]; // Klaus Brockhaus, Feb 07 2011
-
N:= 1000; # to get the first N entries
P:= Array(1..N,numtheory:-phi);
A:= map(t -> 2*round(t)-1, Statistics:-CumulativeSum(P));
convert(A,list); # Robert Israel, Jul 16 2014
-
FoldList[ Plus, 1, 2 Array[ EulerPhi, 60, 2 ] ] (* Olivier Gérard, Aug 15 1997 *)
Accumulate[2*EulerPhi[Range[60]]]-1 (* Harvey P. Dale, Oct 21 2013 *)
-
a(n)=sum(k=1,n,moebius(k)*(n\k)^2)
-
A018805(n)=2 *sum(j=1, n, eulerphi(j)) - 1;
for(n=1, 99, print1(A018805(n), ", ")); /* show terms */
-
a(n)=my(s); forsquarefree(k=1,n, s+=moebius(k)*(n\k[1])^2); s \\ Charles R Greathouse IV, Jan 08 2018
-
from sympy import sieve
def A018805(n): return 2*sum(t for t in sieve.totientrange(1,n+1)) - 1 # Chai Wah Wu, Mar 23 2021
-
from functools import lru_cache
@lru_cache(maxsize=None)
def A018805(n): # based on second formula
if n == 0:
return 0
c, j = 1, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += (j2-j)*A018805(k1)
j, k1 = j2, n//j2
return n*(n-1)-c+j # Chai Wah Wu, Mar 24 2021
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
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, ...
...
- Alain Daurat, M. Tajine, and M. Zouaoui, About the frequencies of some patterns in digital planes. Application to area estimators. Computers & Graphics. 33.1 (2009), 11-20.
- Daniel Khoshnoudirad, Farey lines defining Farey diagrams and application to some discrete structures, Applicable Analysis and Discrete Mathematics, 9 (2015), 73-84; doi:10.2298/AADM150219008K. See Theorem 1, |DF(m,n)|.
-
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:
-
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 *)
A331781
Triangle read by rows: T(m,n) = Sum_{0= n >= 1.
Original entry on oeis.org
0, 0, 1, 0, 2, 3, 0, 3, 5, 7, 0, 4, 6, 9, 11, 0, 5, 8, 12, 15, 19, 0, 6, 9, 13, 16, 21, 23, 0, 7, 11, 16, 20, 26, 29, 35, 0, 8, 12, 18, 22, 29, 32, 39, 43, 0, 9, 14, 20, 25, 33, 36, 44, 49, 55, 0, 10, 15, 22, 27, 35, 38, 47, 52, 59, 63, 0, 11, 17, 25, 31, 40, 44, 54, 60, 68, 73, 83
Offset: 1
Triangle begins:
0,
0, 1,
0, 2, 3,
0, 3, 5, 7,
0, 4, 6, 9, 11,
0, 5, 8, 12, 15, 19,
0, 6, 9, 13, 16, 21, 23,
0, 7, 11, 16, 20, 26, 29, 35,
0, 8, 12, 18, 22, 29, 32, 39, 43,
0, 9, 14, 20, 25, 33, 36, 44, 49, 55
...
A333295 is essentially the same array.
-
VS := proc(m,n) local a,i,j; a:=0;
for i from 1 to m-1 do for j from 1 to n-1 do
if gcd(i,j)=1 then a:=a+1; fi; od: od: a; end;
for m from 1 to 12 do lprint([seq(VS(m,n),n=1..m)]); od:
-
Table[Sum[Boole[# == 1] # &@ GCD[i, j], {i, m - 1}, {j, n - 1}], {m, 12}, {n, m}] // Flatten (* Michael De Vlieger, Feb 12 2020 *)
A358304
Array read by antidiagonals: T(n,k) (n>=0, k>=0) = number of decreasing lines defining the Farey diagram Farey(n,k) of order (n,k).
Original entry on oeis.org
0, 0, 0, 0, 2, 0, 0, 5, 5, 0, 0, 9, 10, 9, 0, 0, 14, 19, 19, 14, 0, 0, 20, 27, 32, 27, 20, 0, 0, 27, 40, 47, 47, 40, 27, 0, 0, 35, 51, 68, 66, 68, 51, 35, 0, 0, 44, 68, 85, 96, 96, 85, 68, 44, 0, 0, 54, 82, 112, 118, 134, 118, 112, 82, 54, 0, 0, 65, 103, 137, 156, 167, 167, 156, 137, 103, 65, 0, 0, 77, 120, 166, 187, 217, 204, 217, 187, 166, 120, 77, 0
Offset: 0
The full array T(n,k), n >= 0, k >= 0, begins:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ..
0, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90, ..
0, 5, 10, 19, 27, 40, 51, 68, 82, 103, 120, 145, 165, ..
0, 9, 19, 32, 47, 68, 85, 112, 137, 166, 196, 235, 265, ..
0, 14, 27, 47, 66, 96, 118, 156, 187, 229, 266, 320, 358, ..
0, 20, 40, 68, 96, 134, 167, 217, 261, 317, 366, 436, 491, ..
0, 27, 51, 85, 118, 167, 204, 267, 318, 384, 441, 528, 589, ..
...
-
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;
DFD:=proc(m,n) local d,t1,u,v; global A005728, Amn;
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:
t1; end;
for m from 0 to 8 do lprint([seq(DFD(m,n),n=0..20)]); od:
-
T[n_, k_] := Sum[d = GCD[u, v]; If[d >= 1, (u+v)*EulerPhi[d]/d, 0], {u, 1, n}, {v, 1, k}];
Table[T[n-k, k], {n, 0, 12}, {k, 0, n}] // Flatten (* Jean-François Alcover, Apr 18 2023 *)
A333297
a(n) = Sum_{i=1..n, j=1..n, gcd(i,j)=1} i.
Original entry on oeis.org
1, 4, 13, 25, 55, 73, 136, 184, 265, 325, 490, 562, 796, 922, 1102, 1294, 1702, 1864, 2377, 2617, 2995, 3325, 4084, 4372, 5122, 5590, 6319, 6823, 8041, 8401, 9796, 10564, 11554, 12370, 13630, 14278, 16276, 17302, 18706, 19666, 22126, 22882, 25591, 26911, 28531, 30049, 33292, 34444, 37531, 39031
Offset: 1
-
Vi := proc(m,n) local a,i,j; a:=0;
for i from 1 to m do for j from 1 to n do
if igcd(i,j)=1 then a:=a+i; fi; od: od: a; end;
# the diagonal :
[seq(Vi(n,n),n=1..50)];
# second Maple program:
a:= proc(n) option remember; `if`(n<2, n,
a(n-1) + 3*n*numtheory[phi](n)/2)
end:
seq(a(n), n=1..50); # Alois P. Heinz, Mar 25 2020
-
a[n_] := a[n] = If[n < 2, n, a[n - 1] + 3 n EulerPhi[n]/2];
Array[a, 50] (* Jean-François Alcover, Nov 27 2020, after Alois P. Heinz *)
-
a(n)={my(s=0);for(i=1,n,for(j=1,n,if(gcd(i,j)==1,s+=i)));s};
for(k=1,45,print1(a(k),", ")) \\ Hugo Pfoertner, Mar 25 2020
A358299
Triangle read by antidiagonals: T(n,k) (n>=0, 0 <= k <= n) = number of lines defining the Farey diagram of order (n,k).
Original entry on oeis.org
2, 3, 6, 4, 11, 20, 6, 19, 36, 60, 8, 29, 52, 88, 124, 12, 43, 78, 128, 180, 252, 14, 57, 100, 162, 224, 316, 388, 20, 77, 136, 216, 298, 412, 508, 652, 24, 97, 166, 266, 360, 498, 608, 780, 924, 30, 121, 210, 326, 444, 608, 738, 940, 1116, 1332, 34, 145, 246, 386, 518, 706, 852, 1086, 1280, 1532, 1748
Offset: 0
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, ...
...
-
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:
A358305
Triangle read by rows: T(n,k) (n>=0, 0 <= k <= n) = number of decreasing lines defining the Farey diagram Farey(n,k) of order (n,k).
Original entry on oeis.org
0, 0, 2, 0, 5, 10, 0, 9, 19, 32, 0, 14, 27, 47, 66, 0, 20, 40, 68, 96, 134, 0, 27, 51, 85, 118, 167, 204, 0, 35, 68, 112, 156, 217, 267, 342, 0, 44, 82, 137, 187, 261, 318, 408, 482, 0, 54, 103, 166, 229, 317, 384, 490, 581, 692, 0, 65, 120, 196, 266, 366, 441, 564, 664, 794, 904
Offset: 0
The full array T(n,k), n >= 0, k>= 0, begins:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
0, 2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90, ...
0, 5, 10, 19, 27, 40, 51, 68, 82, 103, 120, 145, ...
0, 9, 19, 32, 47, 68, 85, 112, 137, 166, 196, 235, ...
0, 14, 27, 47, 66, 96, 118, 156, 187, 229, 266, ...
0, 20, 40, 68, 96, 134, 167, 217, 261, 317, 366, ...
0, 27, 51, 85, 118, 167, 204, 267, 318, 384, 441, ...
-
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;
DFD:=proc(m,n) local d,t1,u,v; global A005728, Amn;
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:
t1; end;
for m from 0 to 8 do lprint([seq(DFD(m,n),n=0..20)]); od:
-
T[n_, k_] := Sum[d = GCD[u, v]; If[d >= 1, (u+v)*EulerPhi[d]/d, 0], {u, 1, n}, {v, 1, k}];
Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Apr 18 2023 *)
Showing 1-7 of 7 results.
Comments