login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A104461 Number of instances of nonprimes m in Pythagorean triples x,y,z such that x^2 + y^2 = z^2. Except for 1, the number of instances of composite numbers m in Pythagorean triples. 0
0, 1, 1, 2, 2, 2, 4, 1, 5, 3, 2, 5, 4, 1, 7, 4, 2, 3, 4, 5, 4, 4, 2, 5, 7, 1, 5, 8, 4, 4, 8, 1, 10, 2, 4, 5, 5, 3, 5, 7, 4, 2, 14, 1, 7, 5, 8, 4, 5, 4, 5, 12, 2, 9, 4, 4, 5, 11, 4, 2, 13, 8, 1, 5, 7, 8, 5, 4, 4, 1, 5, 13, 2, 7, 9, 5, 8, 14, 2, 10, 5, 5, 10, 4, 5, 5, 8, 1, 5, 23, 2, 2, 5, 4, 6, 7, 6, 4, 8, 13 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
The PARI script is direct and very fast for m = x,y values but slows in the trial routine for m = z. We save some time for m even allowing the testing of only even values of y.
LINKS
FORMULA
Consider Pythagorean triples x^2 + y^2 = z^2. We seek to find the total number of instances of an integer m being x or y or z. The solution for x or y is straightforward by considering appropriate lesser and greater pairwise factors, L, G of m^2 in z^2 - y^2 = (z-y)(z+y) = m^2. Then solve for z and y with the relations, z-y = L z+y = G 2z = L+G, z = (L+G)/2 where L and G are both even if m is even or both odd if m is odd. The number of L factors < m is the number of instances of x or y. The count of instances z=m is solved by trial on x^2 = m^2 - y^2.
EXAMPLE
For m=30 there are 5 Pythagorean triples that have a 30:
30, 224, 226
30, 72, 78
30, 40, 50
30, 16, 34
18, 24, 30
PROG
(PARI)
\\ instances of m in Pythagorean triples using a direct method for x, y
pythm3(m) = { local(m2, ln, j, j2=0, d, d2, q2, q, a, b, x, x1, x2, xx, y, y2, z, c, c2, r, f, str, stp); d=divisors(m^2); /* get the divisors of m^2 */ ln=length(d)-1; d2=q2=vector(ln); m2=m^2; if(m%2, r=1, r=0); for(j=1, ln, /* save only the both even r=0, both odd r=1 */ if(d[j]%2==r, if(m2/d[j]%2==r, j2++; d2[j2]=d[j]; q2[j2]=m2/d[j]; /* save m/factor to solve (z-y)(z+y) = m^2 */ ) ) ); x2=y2 = vector(20); for(j=1, j2, z=(d2[j] + q2[j])/2; y= z - d2[j]; if(y>0, c++; ) ); if(m%2==0, start=2; step=2, start=1; step=1); forstep(y=start, m-1, step, /* esolve when z is m */ x1 = (m2-y^2); if(issquare(x1), c2++; x2[c2]=floor(sqrt(x1)); /* save to later mask dupes */ y2[c2]=y; ) ); for(x=1, c2, /* mask the dupes routine */ for(y=x, c2, if(x2[x]==y2[y], ) ) ); return(c+c2/2) /* print total */}
for(k=1, 400, if(isprime(k)==0, print1(pythm3(k)", ")))
CROSSREFS
Sequence in context: A358318 A071470 A197116 * A308042 A335694 A084862
KEYWORD
easy,nonn
AUTHOR
Cino Hilliard, Apr 18 2005
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 06:14 EDT 2024. Contains 371964 sequences. (Running on oeis4.)