Aristotle Python Solution

From
Revision as of 10:11, 6 September 2023 by Williamgray ywa14u61 (talk | contribs) (Simple Python Code)
Jump to: navigation, search

Simple Python Code

for a in range(19):
       aa=a+1
       for b in range(19):
           bb=b+1
           cc = 38 - (aa + bb)
           if ( not (aa in [bb, cc]) and not (bb in [aa, cc]) and not (cc in [aa,bb]) and (aa+bb > 18)):
               for d in range(19):
                   dd=d+1
                   hh=38-(aa+dd)
                   if (not (dd in [aa,bb,cc]) and (not (hh in [aa,bb,cc])) and ( dd + aa > 18)):
                       for e in range(19):
                           ee=e+1
                           if (not (ee in [aa,bb,cc,dd,hh])):
                               for f in range(19):
                                   ff=f+1
                                   gg=38-(dd+ee+ff)
                                   ll=38-(gg+cc)
                                   if (not (ff in [aa,bb,cc,dd,ee,gg,hh,ll]) and not (gg in [aa,bb,cc,dd,ee,ff,hh,ll]) and not (ll in [aa,bb,cc,dd,ee,ff,gg,hh]) and ( gg > 0 ) and ( gg < 20) and (ll > 0) and (ll < 20) ):
                                       for i in range(19):
                                           ii=i+1
                                           mm=38-(bb+ee+ii)
                                           qq=38-(hh+mm)
                                           if (not (ii in [aa, bb, dd, cc, dd, ee, ff, gg, hh, ll, mm, qq]) and not (mm in [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, ll, qq]) and not (qq in [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, ll, mm]) and (mm > 0) and ( mm < 20) and ( qq > 0 ) and ( qq < 20 ) ):
                                               for k in range(19):
                                                   kk=k+1
                                                   pp=38-(kk+bb+ff)
                                                   ss=38-(ll+pp)
                                                   rr=38-(qq+ss)
                                                   nn=38-(dd+ii+rr)
                                                   oo=38-(gg+kk+rr)
                                                   if (not (kk in [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, ll, mm, nn, oo, pp, qq, rr, ss]) and not (pp in  [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, kk, ll, mm, nn, oo, qq, rr, ss]) and not (ss in  [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, kk, ll, mm, nn, oo, pp, qq, rr]) and not ( rr in  [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, kk, ll, mm, nn, oo, pp, qq, ss] ) and not ( nn in  [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, kk, ll, mm, oo, pp, qq, rr, ss]) and not ( oo in  [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, kk, ll, mm, nn,  pp, qq, rr, ss]) and (pp > 0) and (pp < 20) and (ss > 0) and (ss < 20) and (rr > 0) and (rr < 20) and (nn > 0) and (nn < 20) and (oo > 0) and (oo < 20) and (mm+nn+oo+pp == 38) ):
                                                       for j in range(19):
                                                           jj=j+1
                                                           if ( not (jj in  [aa, bb, dd, cc, dd, ee, ff, gg, hh, ii, ll, mm, nn, oo, pp, qq, rr, ss]) and ( hh+ ii + jj + kk + ll == 38) ):
                                                               print (aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss)

Solutions

3 17 18 19 7 1 11 16 2 5 6 9 12 4 8 14 10 13 15 3 19 16 17 7 2 12 18 1 5 4 10 11 6 8 13 9 14 15 9 11 18 14 6 1 17 15 8 5 7 3 13 4 2 19 10 12 16 9 14 15 11 6 8 13 18 1 5 4 10 17 7 2 12 3 19 16 10 12 16 13 4 2 19 15 8 5 7 3 14 6 1 17 9 11 18 10 13 15 12 4 8 14 16 2 5 6 9 19 7 1 11 3 17 18 15 13 10 14 8 4 12 9 6 5 2 16 11 1 7 19 18 17 3 15 14 9 13 8 6 11 10 4 5 1 18 12 2 7 17 16 19 3 16 12 10 19 2 4 13 3 7 5 8 15 17 1 6 14 18 11 9 16 19 3 12 2 7 17 10 4 5 1 18 13 8 6 11 15 14 9 18 11 9 17 1 6 14 3 7 5 8 15 19 2 4 13 16 12 10 18 17 3 11 1 7 19 9 6 5 2 16 14 8 4 12 15 13 10