A360452
Number of fractions c/d with |c| <= d <= 2n and odd denominator when factors of 2 are canceled.
Original entry on oeis.org
0, 3, 7, 15, 27, 39, 59, 83, 99, 131, 167, 191, 235, 275, 311, 367, 427, 467, 515, 587, 635, 715, 799, 847, 939, 1023, 1087, 1191, 1271, 1343, 1459, 1579, 1651, 1747, 1879, 1967, 2107, 2251, 2331, 2451, 2607, 2715, 2879, 3007, 3119, 3295, 3439, 3559, 3703, 3895, 4015
Offset: 0
For n = 0, there is no possible fraction, since the denominator can't be zero.
For n = 1, we have a(1) = #{ -1/1, 0/1, 1/1} = 3; using denominator d = 2 would not give other elements with odd denominator after cancellations, cf. comments.
For n = 2, we have a(2) = #{-1/1, -2/3, -1/3, 0, 1/3, 2/3, 1/1} = 7.
For n = 3, we have a(3) = #{-1/1, -4/5, -2/3, -3/5, -2/5, -1/3, -1/5, 0, 1/5, 1/3, 2/5, 3/5, 2/3, 4/5, 1/1} = 15. As explained in comments, only odd d are useful.
-
a(n)=#Set(concat([[c/d|c<-[-d..d],d && denominator(c/d)%2]|d<-[0..n*2]])) \\ For illustration only. Remove the # to see the elements. Obviously the code could be optimized.
-
apply( {A360452(n) = sum(i=0, n-1, eulerphi(2*i+1))*2+!!n}, [0..10]) \\ This should be used to define the "official" function A360452.
-
# uses programs from A002088 and A049690
def A360452(n): return (A002088((n<<1)-1)-A049690(n-1)<<1)|1 if n else 0 # Chai Wah Wu, Aug 04 2024
A374263
Number of distinct primitive Pythagorean triples (j^2 - k^2, 2*j*k, j^2 + k^2) where 1 <= k < j <= n.
Original entry on oeis.org
1, 2, 4, 6, 8, 11, 15, 18, 22, 27, 31, 37, 43, 47, 55, 63, 69, 78, 86, 92, 102, 113, 121, 131, 143, 152, 164, 178, 186, 201, 217, 227, 243, 255, 267, 285, 303, 315, 331, 351, 363, 384, 404, 416, 438, 461, 477, 498
Offset: 2
For n=5, the possible pairs for j,k are
Generated Primitive As it's included on
triple triple the list, is it new?
j=2, k=1 -> 3, 4, 5 3, 4, 5 Yes
j=3, k=1 -> 8, 6,10 3, 4, 5 No
j=3, k=2 -> 5,12,13 5,12,13 Yes
j=4, k=1 -> 15, 8,17 8,15,17 Yes
j=4, k=2 -> 12,16,20 3, 4, 5 No
j=4, k=3 -> 7,24,25 7,24,25 Yes
j=5, k=1 -> 24,10,26 5,12,13 No
j=5, k=2 -> 21,20,29 20,21,29 Yes
j=5, k=3 -> 16,30,34 8,15,17 No
j=5, k=4 -> 9,40,41 9,40,41 Yes
Among these there are a(5) = 6 distinct primitive triples.
-
from sympy import totient
def A374263(n): return (sum(totient(n) for n in range(1,n+1,2))>>1) + sum(totient(n) for n in range(2,n+1,2)) # Chai Wah Wu, Aug 04 2024
A375020
Alternating sum phi(1) - phi(2) + phi(3) - phi(4) + ... + ((-1)^(10^n+1))*phi(10^n).
Original entry on oeis.org
1, 6, 970, 101130, 10129180, 1013176996, 101320714074, 10132113873280, 1013211797886962, 101321183436796684, 10132118360452306248, 1013211836390484051818, 101321183641942857932324, 10132118364229503528908162, 1013211836423347845936784704
Offset: 0
A358558
a(n) is the number of pairs (k,m) of positive integers with 1 <= k < m <= n such that gcd(k,m) = 2^t, t > 0.
Original entry on oeis.org
0, 0, 0, 1, 1, 3, 3, 6, 6, 10, 10, 14, 14, 20, 20, 27, 27, 33, 33, 41, 41, 51, 51, 59, 59, 71, 71, 83, 83, 91, 91, 106, 106, 122, 122, 134, 134, 152, 152, 168, 168, 180, 180, 200, 200, 222, 222, 238, 238, 258, 258, 282, 282, 300, 300, 324, 324, 352, 352, 368, 368
Offset: 1
a(6)=3 because gcd(2,4)=2, gcd(2,6)=2, gcd(4,6)=2.
12 and 18 are not 2-friendly because gcd(12,18) = 6.
-
q[n_] := n > 1 && n == 2^IntegerExponent[n, 2]; a[n_] := Module[{c = 0}, Do[Do[If[q[GCD[k, m]], c++], {k, 2, m - 1}], {m, 2, n}]; c]; Array[a, 60] (* Amiram Eldar, Nov 23 2022 *)
-
a(n) = { my(res = 0); forvec(x = vector(2, i, [1,floor(n/2)]), c = gcd(x[1], x[2]); if(c == 1 << logint(c, 2), res++ ) , 2 ); res } \\ David A. Corneth, Nov 24 2022
Comments