<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Gleichung]]></title><description><![CDATA[<p>Hallo hat einer ne Idee wie man das nachfolgend programmiertechnisch lösen könnte. Es geht mit Schleifen, aber die Laufzeit wäre ja extrem hoch.</p>
<p>Bestimme zwei natürliche Zahlen p und q, so dass p<sup>2+q</sup>2 = 24642122;</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/123408/gleichung</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 14:05:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123408.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 Oct 2005 15:50:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 15:50:47 GMT]]></title><description><![CDATA[<p>Hallo hat einer ne Idee wie man das nachfolgend programmiertechnisch lösen könnte. Es geht mit Schleifen, aber die Laufzeit wäre ja extrem hoch.</p>
<p>Bestimme zwei natürliche Zahlen p und q, so dass p<sup>2+q</sup>2 = 24642122;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893540</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893540</guid><dc:creator><![CDATA[Help Please]]></dc:creator><pubDate>Sun, 16 Oct 2005 15:50:47 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 15:58:12 GMT]]></title><description><![CDATA[<p>öhm... umformen?<br />
p<sup>2=diezahl-q</sup>2</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893549</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893549</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Sun, 16 Oct 2005 15:58:12 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:01:07 GMT]]></title><description><![CDATA[<p>Das ist schon klar. P und q sind aber unbekannte. Wenn man eine Schleife bis 24642122 laufen lässt und jede Zahl überprüft die p ergibt dauert das ewig</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893553</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893553</guid><dc:creator><![CDATA[Help Please]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:01:07 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:02:31 GMT]]></title><description><![CDATA[<p>kA obs da einen anderen weg gibt... du kannst musst ja sowieso erstmal nur bis wurzel(diezahl) gehen, dadrüber gehts sowieso nicht mehr</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893556</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893556</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:02:31 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:04:39 GMT]]></title><description><![CDATA[<p>Help Please schrieb:</p>
<blockquote>
<p>Hallo hat einer ne Idee wie man das nachfolgend programmiertechnisch lösen könnte. Es geht mit Schleifen, aber die Laufzeit wäre ja extrem hoch.</p>
</blockquote>
<p>nö, nicht extrem.<br />
wir konstruieren die quadratzahlen als summer ungerader zahlen. und lassen beim hochlaufen von p einfach q entgegenlaufen.<br />
macht bei der initialisierung wohl einmal sqrt für q. und dann ca 5000 schleifendurchläufe, die innen nur vier += und -= haben und zwei sprünge.</p>
<p>aber es fühlt sich irgendwire an, als inge es noch schneller. hab ich da nicht mal sowas gelesen? ich denk drüber nach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893557</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893557</guid><dc:creator><![CDATA[volkars2]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:04:39 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:09:33 GMT]]></title><description><![CDATA[<p>Das System ist im Reellen nicht eindeutig, also gibts eine Abhängigkeitsgleichung zwischen p und q, in diesem Fall</p>
<pre><code>q = sqrt(2462122 - p^2)
</code></pre>
<p>Damit ist q &lt; sqrt(2462122). Also lässt man q von floor(sqrt(2462122)) = 1569 nach unten laufen, bis 2462122 - q^2 eine Quadratzahl ist. In diesem Fall haben wir Glück und gleich das erste Paar passt, also ist</p>
<pre><code>19^2 + 1569^2 = 24642122
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/893559</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893559</guid><dc:creator><![CDATA[0xdeadbeef]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:09:33 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:23:49 GMT]]></title><description><![CDATA[<p>Ok. Danke für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893571</guid><dc:creator><![CDATA[Help Please]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:23:49 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:30:40 GMT]]></title><description><![CDATA[<p><a href="http://www.alpertron.com.ar/4SQUARES.HTM" rel="nofollow">http://www.alpertron.com.ar/4SQUARES.HTM</a><br />
(sorry, ist ein wenig viel, für ein so einfach aussehenden problem. vielleicht doch die schleife nehmen).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893580</guid><dc:creator><![CDATA[volkard2]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:30:40 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:37:15 GMT]]></title><description><![CDATA[<p>Und was ist wenn ich alle Zahlen (z.B. 3479 und 3541 sind ja auch Lösungen) ermitteln will. Dann ist die letzte Lösung ja nicht so komfortabel.<br />
@volkars2: wie meinst du das. Kannst du dich vielleicht ein bischen anders ausdrücken?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893585</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893585</guid><dc:creator><![CDATA[Help Please]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:37:15 GMT</pubDate></item><item><title><![CDATA[Reply to Gleichung on Sun, 16 Oct 2005 16:48:15 GMT]]></title><description><![CDATA[<p>Help Please schrieb:</p>
<blockquote>
<p>Und was ist wenn ich alle Zahlen (z.B. 3479 und 3541 sind ja auch Lösungen) ermitteln will. Dann ist die letzte Lösung ja nicht so komfortabel.<br />
@volkars2: wie meinst du das. Kannst du dich vielleicht ein bischen anders ausdrücken?</p>
</blockquote>
<pre><code class="language-cpp">int n=2462122;
int dp=1;
int p=1;
while(p&lt;n){
   cout&lt;&lt;p&lt;&lt;'\n;
   dp+=2;
   p+=dp;
}
</code></pre>
<p>das hier gibt die quadratzahlen bis sqrt(n) aus.<br />
ohne multiplikationen.</p>
<p>und dann dachte ich an sowas wie</p>
<pre><code class="language-cpp">//ungetestet, nur so reingetippt, hoffentlich ist die idee erkennbar. 
int n=2462122;
int p=1;
int dp=1;
int q=sqrt(n);
int dq=q*q-(q-1)*(q-1)+2;//der deutlichkeit halber so, geht viel schneller//
//aber wir haben die binomischen formeln vergessen
while(p&lt;n){
   do{
      dq-=2;
      q-=dq;
   }while(p+q&gt;n);
   if(p+q==n)
      cout&lt;&lt;p&lt;&lt;' '&lt;&lt;q&lt;&lt;'\n;
   dp+=2;
   p+=dp;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/893595</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893595</guid><dc:creator><![CDATA[volkard2]]></dc:creator><pubDate>Sun, 16 Oct 2005 16:48:15 GMT</pubDate></item></channel></rss>