This site is supported by donations to The OEIS Foundation.
User:Oskar Wieland
From OeisWiki
I'm a software developer based in Munich, Germany
Pythagoras triangles
Just as shorthand, this is the proposed function:
int A078644(int64 i) { int result = 0; int64 xx = 4*i*i; for(int64 n=1,x=i+i+1;;n++,x++) { xx += x+x-1; if(xx%n) continue; int64 xn = xx/n; if(xn%2 != n%2) continue; if((xn-n)/2 > x) result++; else return result; } }
Here's the formatted code, yz represents the hypotenuse, y and z are the legs:
int A000005(int64 i) { int result = 0; int64 xx = 4*i*i; for(int64 n=1,x=i+i+1;;n++,x++) { xx += x+x-1; if(xx%n) continue; int64 yz = xx/n; if(yz%2 != n%2) continue; int64 y = (yz-n)/2, z = (yz+n)/2; if(y <= x) return result; if(GCD(x,GCD(y,z)) == n) result++; } } int A068068(int64 i) { int result = 0; int64 xx = 4*i*i; for(int64 n=1,x=i+i+1;;n++,x++) { xx += x+x-1; if(xx%n) continue; int64 yz = xx/n; if(yz%2 != n%2) continue; int64 y = (yz-n)/2, z = (yz+n)/2; if(y <= x) return result; if(GCD(x,GCD(y,z)) == 1) result++; } }
Example with radius 24:
1: (49,1200,1201) 2: (50,624,626) = 2x (25,312,313) 3: (51,432,435) = 3x (17,144,145) 4: (52,336,340) = 4x (13,84,85) 6: (54,240,246) = 6x (9,40,41) 8: (56,192,200) = 8x (7,24,25) 9: (57,176,185) 12: (60,144,156) = 12x (5,12,13) 16: (64,120,136) = 8x (8,15,17) 18: (66,112,130) = 2x (33,56,65) 24: (72,96,120) = 24x (3,4,5) 32: (80,84,116) = 4x (20,21,29) A078644(24) = 12, A000005(24) = 8, A068068(24) = 2
- A068068 -> number of primitive pythagorean triangles (PPT)
- 1: (49,1200,1201)
- 9: (57,176,185)
- A000005 -> number where the index (difference between hypotenuse and the 2nd leg) and PPT multiplicator are the same
- 1: (49,1200,1201)
- 2: (50,624,626) = 2x (25,312,313)
- 3: (51,432,435) = 3x (17,144,145)
- 4: (52,336,340) = 4x (13,84,85)
- 6: (54,240,246) = 6x (9,40,41)
- 8: (56,192,200) = 8x (7,24,25)
- 12: (60,144,156) = 12x (5,12,13)
- 24: (72,96,120) = 24x (3,4,5)
- A078644 -> total number of triangles
Example with radius 25:
1: (51,1300,1301) 2: (52,675,677) 5: (55,300,305) = 5x (11,60,61) 10: (60,175,185) = 5x (12,35,37) 25: (75,100,125) = 25x (3,4,5) A078644(25) = 5, A000005(25) = 3, A068068(25) = 2
Example with radius 26:
1: (53,1404,1405) 2: (54,728,730) = 2x (27,364,365) 4: (56,390,394) = 2x (28,195,197) 8: (60,221,229) 13: (65,156,169) = 13x (5,12,13) 26: (78,104,130) = 26x (3,4,5) A078644(26) = 6, A000005(26) = 4, A068068(26) = 2
Sequences inside the pentagonal numbers A000326 and A001318
A000326 (not generalized):
|
A001318 (generalized):
|