Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A104461
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
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
1
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; listen)
OFFSET

1,4

COMMENT

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 for m even allowing to test only even values of y.

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 straight forward 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

PROGRAM

(PARI) for(k=1, 400, if(isprime(k)==0, print1(pythm3(k)", "))) \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 }

CROSSREFS

Cf. A046081 A088978.

Sequence in context: A010583 A051007 A071470 this_sequence A084862 A138260 A027387

Adjacent sequences: A104458 A104459 A104460 this_sequence A104462 A104463 A104464

KEYWORD

easy,nonn

AUTHOR

Cino Hilliard (hillcino368(AT)gmail.com), Apr 18 2005

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 27 14:50 EST 2009. Contains 167570 sequences.


AT&T Labs Research