[Date Index]
[Thread Index]
[Author Index]
Re: Integers that are the sum of 2 nonzero squares in exactly 2 ways
*To*: mathgroup at smc.vnet.net
*Subject*: [mg125946] Re: Integers that are the sum of 2 nonzero squares in exactly 2 ways
*From*: Dana DeLouis <dana01 at me.com>
*Date*: Sun, 8 Apr 2012 04:18:25 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
> I don't know if this answers anything, but the factorization pattern of such numbers appears to be as follows.
> All primes of the form 4n+3 > occur to even powers.
Hi. I can't add much, but this article was very interesting...
http://mathworld.wolfram.com/SumofSquaresFunction.html
One of the codes along the line of 4n+3 was the following:
MySquaresRUnordered[n_Integer?NonNegative] := Module[
{b, p, q, primes, powers},
{primes, powers} = Transpose[FactorInteger[n]];
mod1 = Flatten[Position[primes, _?(Mod[#, 4] == 1 &)]];
mod3 = Flatten[Position[primes, _?(Mod[#, 4] == 3 &)]];
If[Or @@ (OddQ /@ powers[[mod3]]),
0,
(*Else*)
b = Times @@ (1 + # & /@ powers[[mod1]]);
If[EvenQ[b], b, b + 1]/2
]
]
But this still considers zero a solution, which the Op does not want.
This is not faster, but just interesting.
A workaround might be that we want those solutions that equal length 2, but where the square root of the number is not an integer.
For example, 400 has two solutions:
PowersRepresentations[400,2,2]
{{0,20},{12,16}}
But... the square root of 400 is the integer 20, so this would not be a valid solution.
However, we also need those of length 3, but where the square of the number is an integer.
For example, 625 has 3 solutions. but since 25^2 = 625, we can disregard this solution, and assume the remaining 2 solutions are valid.
PowersRepresentations[625,2,2]
{{0,25},{7,24},{15,20}}
Sqrt[625]
25
So, with two aux functions:
NotSquare[n_] := Not[IntegerQ[Sqrt[n]]]
IsSquare[n_] := IntegerQ[Sqrt[n]]
For this idea, you have a table of numbers....
tbl=Table[{n,MySquaresRUnordered[n]},{n,820}];
tt=Cases[tbl,{_,n_/;n==2}][[All,1]]
{25,50,65,85,100,125,130,145,169,170,185,200,205,.. ..}
But we disregard those that have an integer as a square root.
lst1=Select[tt,NotSquare]
{50,65,85,125,130,145,170,185,200,205,...}
However, the number 625 is missing from this small list.
We need to look at the few that have 3 as a solution, and also HAS an integer as a square root.
lst2=Select[Cases[tbl,{_,n_/;n==3}][[All,1]],IsSquare]
{625}
This is ok for small ranges, but slow when the range is large.
Only2[n_] := Piecewise[
{{(SquaresR[2, n] - 4)/8 == 2, IntegerQ[Sqrt[n]]},
{(SquaresR[2, n] - 4)/8 == 1, IntegerQ[Sqrt[n/2]]},
{SquaresR[2, n]/8 == 2, True}}]
Select[Range[820],Only2]
{50,65,85,125,130,145,170,185,200,205,221,...}
= = = = = = = = = = = = = = =
Interesting subject :>)
Dana DeLouis
Mac & Math 8
= = = = = = = = = = = = = = =
On Mar 31, 4:44 am, d... at wolfram.com wrote:
> On Wednesday, March 28, 2012 5:00:45 AM UTC-5, Cisco Lane wrote:
> > I've been looking at integers that are the sum of 2 nonzero squares in exactly 2 ways. The smallest example is 50 = 5^2+5^2=7^2+1^2. The first few terms are 50, 65, 85, 125, 130, 145, .... This is given in OEIS ashttps://oeis.org/A025285
>
> > If I plot the pairs {1,50},{2,65},{3,85},... I get a more or less straight line with a slope of about 8.85... In other words, eventually, about one in 8.85 integers qualify.
>
> > I wonder if there is a theoretical value for this approximate number of 8.85...?
>
> I don't know if this answers anything, but the factorization pattern of such numbers appears to be as follows. All primes of the form 4n+3 occur to even powers. There are one, two or three other factors. They can take the form
>
> 2^n*p*q where p and q are distinct primes of the form 4n+1, n an arbitrary nonnegative integer
>
> 2^(2*n+1)*p^2 with n, p as above
>
> 2^(2*n)*p^(2*k) for n as above and k satisfying some relation I cannot quite figure out other than it has to be at least 2. There may also be further restrictions on n that depend on k.
>
> Daniel Lichtblau
> Wolfram Research
Re: Integers that are the sum of 2 nonzero squares in exactly 2 ways
Prev by Date:
**Re: fyi, small note on using Mathematica for object**
Next by Date:
**Where is ShowGraph?**
Previous by thread:
**Re: Integers that are the sum of 2 nonzero squares in**
Next by thread:
**Find common elements in a list of sublists**
| |