This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A104461 #20 Mar 08 2016 10:11:30 %S A104461 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, %T A104461 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, %U A104461 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 %N 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. %C A104461 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. %F A104461 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. %e A104461 For m=30 there are 5 Pythagorean triples that have a 30: %e A104461 30, 224, 226 %e A104461 30, 72, 78 %e A104461 30, 40, 50 %e A104461 30, 16, 34 %e A104461 18, 24, 30 %o A104461 (PARI) %o A104461 \\ instances of m in Pythagorean triples using a direct method for x,y %o A104461 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 */} %o A104461 for(k=1,400,if(isprime(k)==0,print1(pythm3(k)", "))) %Y A104461 Cf. A046081, A088978. %K A104461 easy,nonn %O A104461 1,4 %A A104461 _Cino Hilliard_, Apr 18 2005