<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Commentaires sur : Problème sympa vu sur twitter	</title>
	<atom:link href="https://mathix.org/linux/archives/17628/feed" rel="self" type="application/rss+xml" />
	<link>https://mathix.org/linux/archives/17628</link>
	<description>L&#039;enseignement, des maths et le &#34;Libre&#34;</description>
	<lastBuildDate>Sat, 08 Oct 2022 12:53:15 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		Par : Pascal Peter		</title>
		<link>https://mathix.org/linux/archives/17628#comment-24786</link>

		<dc:creator><![CDATA[Pascal Peter]]></dc:creator>
		<pubDate>Sat, 08 Oct 2022 12:53:15 +0000</pubDate>
		<guid isPermaLink="false">https://mathix.org/linux/?p=17628#comment-24786</guid>

					<description><![CDATA[Désolé le commentaire a perdu les indentations du code.
Du coup je l&#039;ai placé là :
https://gitlab.com/-/snippets/2424006]]></description>
			<content:encoded><![CDATA[<p>Désolé le commentaire a perdu les indentations du code.<br />
Du coup je l&rsquo;ai placé là :<br />
<a href="https://gitlab.com/-/snippets/2424006" rel="nofollow ugc">https://gitlab.com/-/snippets/2424006</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		Par : Pascal Peter		</title>
		<link>https://mathix.org/linux/archives/17628#comment-24784</link>

		<dc:creator><![CDATA[Pascal Peter]]></dc:creator>
		<pubDate>Sat, 08 Oct 2022 11:07:44 +0000</pubDate>
		<guid isPermaLink="false">https://mathix.org/linux/?p=17628#comment-24784</guid>

					<description><![CDATA[Bonjour,
j&#039;ai commis le programme Python ci-dessous pour trouver les solutions à ce problème.
Il en a trouvé 4 (en écartant les cas symétriques).

----

def popopop(l, n):
    try:
        l.pop(l.index(n))
        return True
    except:
        return False

def calcule(a, b, c, d):
    aa = abs(a - b)
    bb = abs(b - c)
    cc = abs(c - d)
    aaa = abs(aa - bb)
    bbb = abs(bb - cc)
    aaaa = abs(aaa - bbb)
    return aa, bb, cc, aaa, bbb, aaaa


SOLUTIONS = []

for i in range(10):
    a = i + 1
    la = [n+1 for n in range(10)]
    la.pop(la.index(a))
    for b in la:
        lb = [n for n in la]
        popopop(lb, b)
        for c in lb:
            lc = [n for n in lb]
            popopop(lc, c)
            for d in lc:
                ld = [n for n in lc]
                popopop(ld, d)
                # pour éviter les solutions symétriques :
                if (d, c, b, a) in SOLUTIONS:
                    continue
                aa, bb, cc, aaa, bbb, aaaa = calcule(a, b, c, d)
                if not(popopop(ld, aa)):
                    continue
                if not(popopop(ld, bb)):
                    continue
                if not(popopop(ld, cc)):
                    continue
                if not(popopop(ld, aaa)):
                    continue
                if not(popopop(ld, bbb)):
                    continue
                if not(popopop(ld, aaaa)):
                    continue
                #print(a, b, c, d)
                SOLUTIONS.append((a, b, c, d))


for (a, b, c, d) in SOLUTIONS:
    aa, bb, cc, aaa, bbb, aaaa = calcule(a, b, c, d)
    print(&#039; &#039;*3, aaaa)
    print(&#039; &#039;*2, aaa, bbb)
    print(&#039; &#039;*1, aa, bb, cc)
    print(a, b, c, d)]]></description>
			<content:encoded><![CDATA[<p>Bonjour,<br />
j&rsquo;ai commis le programme Python ci-dessous pour trouver les solutions à ce problème.<br />
Il en a trouvé 4 (en écartant les cas symétriques).</p>
<p>&#8212;-</p>
<p>def popopop(l, n):<br />
    try:<br />
        l.pop(l.index(n))<br />
        return True<br />
    except:<br />
        return False</p>
<p>def calcule(a, b, c, d):<br />
    aa = abs(a &#8211; b)<br />
    bb = abs(b &#8211; c)<br />
    cc = abs(c &#8211; d)<br />
    aaa = abs(aa &#8211; bb)<br />
    bbb = abs(bb &#8211; cc)<br />
    aaaa = abs(aaa &#8211; bbb)<br />
    return aa, bb, cc, aaa, bbb, aaaa</p>
<p>SOLUTIONS = []</p>
<p>for i in range(10):<br />
    a = i + 1<br />
    la = [n+1 for n in range(10)]<br />
    la.pop(la.index(a))<br />
    for b in la:<br />
        lb = [n for n in la]<br />
        popopop(lb, b)<br />
        for c in lb:<br />
            lc = [n for n in lb]<br />
            popopop(lc, c)<br />
            for d in lc:<br />
                ld = [n for n in lc]<br />
                popopop(ld, d)<br />
                # pour éviter les solutions symétriques :<br />
                if (d, c, b, a) in SOLUTIONS:<br />
                    continue<br />
                aa, bb, cc, aaa, bbb, aaaa = calcule(a, b, c, d)<br />
                if not(popopop(ld, aa)):<br />
                    continue<br />
                if not(popopop(ld, bb)):<br />
                    continue<br />
                if not(popopop(ld, cc)):<br />
                    continue<br />
                if not(popopop(ld, aaa)):<br />
                    continue<br />
                if not(popopop(ld, bbb)):<br />
                    continue<br />
                if not(popopop(ld, aaaa)):<br />
                    continue<br />
                #print(a, b, c, d)<br />
                SOLUTIONS.append((a, b, c, d))</p>
<p>for (a, b, c, d) in SOLUTIONS:<br />
    aa, bb, cc, aaa, bbb, aaaa = calcule(a, b, c, d)<br />
    print(&lsquo; &lsquo;*3, aaaa)<br />
    print(&lsquo; &lsquo;*2, aaa, bbb)<br />
    print(&lsquo; &lsquo;*1, aa, bb, cc)<br />
    print(a, b, c, d)</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
