Re: Integers that are the sum of 2 nonzero squares in exactly 2
- To: mathgroup at smc.vnet.net
- Subject: [mg125726] Re: Integers that are the sum of 2 nonzero squares in exactly 2
- From: Cisco Lane <travlorf at yahoo.com>
- Date: Fri, 30 Mar 2012 04:34:16 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Hi - thanks for the help. I should have said 2 positive squares, without respect to order. So for the case of 50, its {5,5} and {1,7} only. SquaresR gives {5,5},{1,7},{7,1} times four, for the four permutations of sign {+,+},{+,_},{-,+} and {-,-}. I'm trying to find energy eigenfunctions, with energy proportional to n^2. An eigenfunction will be a linear combination of all wave functions with the same energy. Right now, I'm just concerned with pairs. Then triplets, etc. The slope is an average, so the first 3 does not have enough data points to draw any conclusions, I think. I tried using your method out to 500 to get: t=Table[{n,PowersRepresentations[n,2,2]},{n,500}]; tt=First/@Select[t,Length[Last[#]]==2 &] //Rest {50, 65, 85, 100, 125, 130, 145, 169, 170, 185, 200, 205, 221, 225, 250, 260, 265, 289, 290, 305, 338, 340, 365, 370, 377, 400, 410, 442, 445, 450, 481, 485, 493, 500} and the first problem I see is 100 - This is perhaps using {10,10} twice, but I don't think 100 is the sum of the squares of a different pair of positive integers. The expression I use is: set2[nmin_, nmax_] := Module[{w, data}, w = Table[{n1, n2, n1^2 + n2^2}, {n1, nmin, nmax}, {n2, n1, nmax}]; w = Flatten[w, 1]; w = Sort[w, #1[[3]] <= #2[[3]] &]; data = {}; data = Reap[ For[i = 1, i <= Length[w] - 2, i++, If[(w[[i, 3]] == w[[i + 1, 3]]) && (w[[i, 3]] != w[[i + 2, 3]]), Sow[w[[i, 3]]] ]] ]; data[[2, 1]] ] which takes the sums of two squares of all numbers between nmin and nmax, without respect to order, and picks out the ones that occur only twice. Kind of inelegant, but it works, except for the higher numbers. For example, if you calculate set2[1,250], you get 7656 entries. You will miss the ones that match {250,250} that are of the form e.g. {1,250^2}. So the "line" goes straight, then takes a jump as some are missed. I have gone out as far as set2[1,2000] which took 76 seconds on my machine and yielded 528,041 pairs of which about 450,000 seem good.
- Follow-Ups:
- Re: Integers that are the sum of 2 nonzero squares in
- From: James Stein <mathgroup@stein.org>
- Re: Integers that are the sum of 2 nonzero squares in