# # Liber Abaci XI.7.13 d  metodo diretto

# SOLUZIONI INTERE POSITIVE DI
#       x1 + x2 + x3  = T
#       3x1 + 2x2+ x3/2 = T     

print("\tLiber Abaci XI.7.13\n\tSOLUZIONI INTERE POSITIVE DI\n\t\t x1 + x2 + x3  = T\n\t\t3x1 + 2x2+ x3/2 = T    metodo diretto\n")
n=1
s=0
for x4 in range (1,30):
    T=31-x4
    a=1
    while 5*a<T:
        if (T-5*a)%3==0:
            b=(T-5*a)/3  
            x1=a
            x2=int(b)
            x3=int(4*a+2*b)
            s=s+1
            if (s-1)%3==0:     print()
            print('\t(',x1,x2,x3,') T=',T,end=" ")
           # print('\t\tverifica: =',3*x1+2*x2+int(x3/2),'==T',T)
            a=a+1        
        else:
            a=a+1        
    n=n+1


