Bill Allombert on Fri, 17 Nov 2023 23:49:32 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: question on efficient but exhaustive 3 squares algorithm
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: question on efficient but exhaustive 3 squares algorithm
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Fri, 17 Nov 2023 23:49:19 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1700261363; c=relaxed/relaxed; bh=USadHn80ov6rpj4Y5sq6gP92LC+OOPcNlr3+bB739NU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; b=IsiIvYth2vYNKSLn+0WjGzwT5W0pr+K56iF66uj5oep/HAkJu/hRFNVqrSAqCNCMV9077NsF1VEfbHHWjLEstasx37qnB2yOjkEPIlyvsiDBQDI6qR0pdK2ss1aoqHViBvrN+FiXzEP7vZr9lOw14yvGNr5jtdGxh1OTv+j5mJC7yvyN4q39sM2nKLvId9TCPCqAKEAP1FF//kF2vjcMwhN0/U8W1U2l6UXpClv72njagoDaNS456+DfzWaBvwAHN1fdETYXay5mIvfZm+bESpWez0Os8PN2jTdxKwGkHaUtXOubXExLKpNkP+nF/bBQnRXe/dg1FjP3F6toojq56ASMP5MtOS8r8DCNfd2GKGYiN6rebFVM+Y8uHLYCgSkygUwqGMp/6yXyunNMXLgu0ExTMhgv7RTbmA7U9jj6UoUsF7UvqGxdmSLgSZ/M+AAtKgmG1vxeEXfKWN79N5svbGrizOXEelKboJuPl+CwGYeuyL3s5akrkdDdrTVylSkPfFEXwjxmTeaKdyRli9x2OFbsj0LcYJxSsanyCkxPuzduH6aW0kW/3h4tW6xzTZmS8CEcz7lD+5y2PJ8xAj3RxKb0rEnhh2u8+dLcSgO1vAH+RyW9x5WwXkkOJJXhza5aqcHGdpwXaheOiGatfdj0Wi6JAl1UQ8YoriBtkNvsVFU=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1700261363; cv=none; b=kiN/m+ua3SyIzQjka3HKK/PwbZcJEasREeY8oCKU59J5p317J5x21rgGIgB/B0Kj4i1z1T8fOeUhUFfh+KtUodEuUHkIuVgz16eTekl1XR/lTxzmFKb55gm5JJ09sUYypmWgW4Ezk91MRIWl/QATH00nO/xrAbKvBZKUsf38NavGiHzzZK3uUabU0dk/79VvRW7+sFUa67KcuRWEgVeGteXhzxsteWjktkU5eukmJQGwu7W4c1h+5sjiBgssDOeTA6RtbObRiePyrJ7vTJjMt7oRU2V9FC+zUzLK3gjnPFFBYEFhxGpwg5MbN914ybPc/moglSJMcmno3zICaCao16C1HAJEH5Ndp2/9/MdYRyDJEgVKP78jErxBNnHm5okpxtGtphISPPWFewEcE5zztCDXuU3ztPmHQLxVAoAbOJKhOzFnUV4bESedq78YKxsW7qUN6vHSUmnk0BOyuTj9TPSSCrr1Q0/NoXRymUGT83wxNd+QYoEQsfDTwovmANoHs7Z6FwifXqspppz7CievV6xsivJoHscsY0YFM0Q66H6Wmq+cuTo7OlvzarhKpwbCEW5H/McZ2H43tKXaE9M9RlVlmWtZYJNemuu1slPPOqQc1UBGtRyti951tWdXSQoNa56aFwAU9x6BtEAE83pefV1VEMSehaP8N5EpWMGnEDI=
- Authentication-results: smail; arc=none
- Delivery-date: Fri, 17 Nov 2023 23:49:32 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1700261362; bh=USadHn80ov6rpj4Y5sq6gP92LC+OOPcNlr3+bB739NU=; h=Date:From:To:Subject:References:In-Reply-To:From; b=aOThYaQ0n7fEk0gle8V2r8D9I4FtTZXTCxusUSCmGFXmvbpojtFEYkmaWwOduGd4F imnim8Z8EswEBspP0+IyP0fQiDtQXFVhyDFfgdJl9JkWXyEp+hkxqcBUci4Cv0BAQQ SaEsctEDs33kn6UAT2LRgfHTng7PxbEX4vSZDE+O307AqN3MaHpHKisyqR0tLdUV85 J+wxDJ14+y6zLDZmEGSb5Cvol3VIEeHRszDaJ8tLv10uFxFOni2PdFPB40ASysy/kF crMstpJm9qvKUP/K7hYdXPKOUWK1XEdEqxp8zr8wqRgzpLyu3gTWHcbVW7AdHbnB6L 4eN00al8xpxOiSHyLigBpx0Oi8dX4x7PvDz7enOcg2zpqXDkYL4mqnIMxiTZWbnUIp QntcGxWsjZaRQjp4Lm0FiVuH5hc7TU3uoIv/61X4s24gtDiXw7V0/oyl3yAEO+49/a 2eVnySHAObf4inalO4SwoyWRQFlrTSM2OYzw8+nvhFbBnZ5fq1TlcQSxZeEXqYsQ94 75Hh2xMPGjtZqqljkvl+2sQA9dMGogQ9vaDVCMycSx6BoxqUMuPIyuIT+MEKB+4SzE aCxia7fvYsgS5+kPfhBzOOJ3cn40/K4dqFINBbzj2shYyy1Bw4mAW73jgECWw7zsZb tpcq0An2rUyFI/jJhDQIEsuI=
- In-reply-to: <9e46ee98-dbb6-4360-923e-9ad0f8c00c34@gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <9e46ee98-dbb6-4360-923e-9ad0f8c00c34@gmail.com>
On Fri, Nov 17, 2023 at 01:54:02PM -0800, American Citizen wrote:
> And I found, comparing the two algorithms that specifically:
>
> for n = [1..8] (skipping n=7) the results are identical
>
> for n = 9, threesquare only posts [0,0,3], but actually there is [2,2,1]
> also
threesquares() returns a single solution by design.
> It can be seen that threesquare is missing some solutions. Furthermore
> threesquares() blows up for N=7,15,23, etc.
Well, you can call isthreesquares beforehand if you are unsure.
> Can we derive an exhaustive threesquares(N) algorithm which does give all
> solutions for a specific N? and returns [] if
> no such representation occurs. This is the same as solving the [1,1,1,0,0,0]
> ternary quadratric form.
The problem is that the number of solutions grows very quickly (as sqrt(n) in
average), so there is no hope of writing a really fast algorithm, but I can
suggest this simple one
sol3(n)=
{
Set(concat(vector(sqrtint(n\3+1)+1,j,
my(i=j-1);
Set([vecsort(concat(i,abs(v)))|v<-qfbsolve(Qfb(1,0,1),n-i^2,3)])
)));
}
> P.S.: My imagination is intrigued by a new number type in GP-Pari, called
> "Qft" for Quadratic ternary form and it takes a vector [a,b,c,d,e,f] or 6
> elements for composition. Just a thought ??
It already exist, just set
Qft(a,b,c,d,e,f)=[a,d/2,e/2; d/2,b,f/2; e/2,f/2,c];
and use qfsolve, qfparam, qfisom, qfauto, etc.
Cheers,
Bill