We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #170: Find the largest 0 to 9 pandigital that can be formed by concatenating products.
  4. Discussions

Project Euler #170: Find the largest 0 to 9 pandigital that can be formed by concatenating products.

Problem
Submissions
Leaderboard
Discussions

    You are viewing a single comment's thread. Return to all comments →

  • kamakshivaidywan 1 year ago+ 0 comments

    t=int(input()) n=int(input())

    main=['0','1','2','3','4','5','6','7','8','9']

    for i in range(1,10): for j in range(1,n): for k in range(1,n):

            si=str(i)
            sj=str(j)
            sk=str(k)
            sss=si+sj+sk
            if len(sss)==10:
                list=[]
                list.append(sss[0])
                stor=False
                for p in sss:
                    stor=False
                    for q in list:
                        if q==p:
                            stor=True
                    if not stor:
                        list.append(p)
                list=sorted(list)
    
                if list==main:
    
                    s=str(i*j)
                    s1=str(i*k)
                    st=s+s1
                    if len(st)==10:
    
                        n1=[]
                        n1.append(st[0])
                        sto=False
                        for l in st:
                            sto=False
                            for m in n1:
                                if m==l:
                                    sto=True
                            if not sto:
                                n1.append(l)
                        n1=sorted(n1)
    
    
                        if n1==main:
    
                            print(i,'*(',j,",",k,")=",st,sep='')
    
    -1|
    Permalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature