<?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[ominöse Funktion]]></title><description><![CDATA[<p>HI,</p>
<p>hab folgende verschachtelte Funktionen gegeben (eigtl. in Haskell):</p>
<p>f(x) := g(2,x)<br />
g(a,b) := if b == 1 then 1 else h(2,a)<em>g(a, b `div` 2)<br />
h(a,b) := if a == 0 then 0 else (a</em>b)+h(a-1, b)</p>
<p>dabei gibt (a `div` b) den ganzzahligen Anteil einer Division von a durch b zurück, also z.B. 7 `div` 2 = 3</p>
<p>Meine Frage ist jetzt, welche Funktionalität durch f(x) implementiert wird, d.h. &quot;was f(x) eigentlich macht&quot;</p>
<p>hab hier mal die ersten paar Funktionswerte, und es hat auch irgendwas mit Potenzen von 6 zu tun (h(2,b) wird glaub ich immer 6).</p>
<p>f 1 = 1<br />
f 2 = 6<br />
f 3 = 6<br />
f 4 = 36<br />
f 5 = 36<br />
f 6 = 36<br />
f 7 = 36<br />
f 8 = 216<br />
f 9 = 216<br />
f 10 = 216<br />
f 11 = 216<br />
f 12 = 216<br />
f 13 = 216<br />
f 14 = 216<br />
f 15 = 216<br />
f 16 = 1296<br />
f 17 = 1296<br />
f 18 = 1296<br />
f 19 = 1296<br />
f 20 = 1296</p>
<p>bestimmt ist das (b `div` 2) auch nicht ganz unwichtig :0)<br />
hoffe mir kann da jemand helfen.</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/180352/ominöse-funktion</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Jul 2026 21:40:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/180352.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 May 2007 16:57:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ominöse Funktion on Tue, 01 May 2007 16:57:56 GMT]]></title><description><![CDATA[<p>HI,</p>
<p>hab folgende verschachtelte Funktionen gegeben (eigtl. in Haskell):</p>
<p>f(x) := g(2,x)<br />
g(a,b) := if b == 1 then 1 else h(2,a)<em>g(a, b `div` 2)<br />
h(a,b) := if a == 0 then 0 else (a</em>b)+h(a-1, b)</p>
<p>dabei gibt (a `div` b) den ganzzahligen Anteil einer Division von a durch b zurück, also z.B. 7 `div` 2 = 3</p>
<p>Meine Frage ist jetzt, welche Funktionalität durch f(x) implementiert wird, d.h. &quot;was f(x) eigentlich macht&quot;</p>
<p>hab hier mal die ersten paar Funktionswerte, und es hat auch irgendwas mit Potenzen von 6 zu tun (h(2,b) wird glaub ich immer 6).</p>
<p>f 1 = 1<br />
f 2 = 6<br />
f 3 = 6<br />
f 4 = 36<br />
f 5 = 36<br />
f 6 = 36<br />
f 7 = 36<br />
f 8 = 216<br />
f 9 = 216<br />
f 10 = 216<br />
f 11 = 216<br />
f 12 = 216<br />
f 13 = 216<br />
f 14 = 216<br />
f 15 = 216<br />
f 16 = 1296<br />
f 17 = 1296<br />
f 18 = 1296<br />
f 19 = 1296<br />
f 20 = 1296</p>
<p>bestimmt ist das (b `div` 2) auch nicht ganz unwichtig :0)<br />
hoffe mir kann da jemand helfen.</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1277065</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1277065</guid><dc:creator><![CDATA[mb2007]]></dc:creator><pubDate>Tue, 01 May 2007 16:57:56 GMT</pubDate></item><item><title><![CDATA[Reply to ominöse Funktion on Tue, 01 May 2007 17:34:21 GMT]]></title><description><![CDATA[<p>2^0 mal die 1<br />
2^1 mal die 6<br />
2^2 mal die 36<br />
2^4 mal die 216<br />
2^5 mal die 216*6<br />
...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1277085</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1277085</guid><dc:creator><![CDATA[depp__]]></dc:creator><pubDate>Tue, 01 May 2007 17:34:21 GMT</pubDate></item><item><title><![CDATA[Reply to ominöse Funktion on Tue, 01 May 2007 17:35:50 GMT]]></title><description><![CDATA[<p>hab mich vertippt.</p>
<p>2^0 mal die 1<br />
2^1 mal die 6<br />
2^2 mal die 36<br />
2^3 mal die 216<br />
2^4 mal die 216*6</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1277088</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1277088</guid><dc:creator><![CDATA[depp__]]></dc:creator><pubDate>Tue, 01 May 2007 17:35:50 GMT</pubDate></item><item><title><![CDATA[Reply to ominöse Funktion on Tue, 01 May 2007 21:50:53 GMT]]></title><description><![CDATA[<p>vielen dank schon mal für die schnelle antwort.</p>
<p>aber eine frage hätte ich noch. wie kann man die jeweilige ausgabe in abhängigkeit von dem funktionswert angeben, bzw. wie realisiert man das gleiche ergebnis auf andere art und weise?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1277216</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1277216</guid><dc:creator><![CDATA[mb2007]]></dc:creator><pubDate>Tue, 01 May 2007 21:50:53 GMT</pubDate></item><item><title><![CDATA[Reply to ominöse Funktion on Wed, 02 May 2007 07:59:25 GMT]]></title><description><![CDATA[<p>mb2007 schrieb:</p>
<blockquote>
<p>vielen dank schon mal für die schnelle antwort.</p>
<p>aber eine frage hätte ich noch. wie kann man die jeweilige ausgabe in abhängigkeit von dem funktionswert angeben, bzw. wie realisiert man das gleiche ergebnis auf andere art und weise?</p>
</blockquote>
<p>in C++ etwa so:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;

int f(int x)
{
         int a = rand();
         int b;

         int rueckgabewert;

         while ( a &lt; b)
               rueckgabewert *= -1;

         rueckgabewert &lt;&lt;= (a &amp; 0xdeadbeef);

         return rueckgabewert;
}
</code></pre>
<p>Das ist zwar nur eine numerische Aproxximation, sollte aber mehr oder weniger das gleiche zurueckgeben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> Wenn du's genau haben muesstest, muesstest du die Funktion so implementieren, wie _depp es dir gesagt hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1277321</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1277321</guid><dc:creator><![CDATA[Blue-Tiger]]></dc:creator><pubDate>Wed, 02 May 2007 07:59:25 GMT</pubDate></item><item><title><![CDATA[Reply to ominöse Funktion on Wed, 02 May 2007 09:01:42 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;math.h&gt;

int f(int x)
{
	return pow(6,int(log(x)/log(2)));
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1277352</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1277352</guid><dc:creator><![CDATA[carstenbauer]]></dc:creator><pubDate>Wed, 02 May 2007 09:01:42 GMT</pubDate></item><item><title><![CDATA[Reply to ominöse Funktion on Wed, 02 May 2007 10:27:47 GMT]]></title><description><![CDATA[<p>oder die iterative Informatik-Lösung (keine math.h benötigt):</p>
<pre><code class="language-cpp">int f2(int x)
{
    x+=1;int i=1,p=1;
    while(x&gt;p) { p+=p; i*=6; };
    return i/6;
}
</code></pre>
<p>Vorteil dieser Lösung: Kein Fehlerpotenzial beim Abschneiden der Nachkommastellen einer Fließkommazahl. Hier wird nur mit Integern gearbeitet!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1277416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1277416</guid><dc:creator><![CDATA[carstenbauer]]></dc:creator><pubDate>Wed, 02 May 2007 10:27:47 GMT</pubDate></item></channel></rss>