title: Python Program No Output
body: <p>The problem is as:</p>
  
  <blockquote>
    <p>The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will
    always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes, 792, represents the
    lowest sum for a set of four primes with this property.
    Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.</p>
  </blockquote>
  
  <p>Now following is the program which is not giving any output in the result list. Please help</p>
  
  <pre><code>LIMIT = 20000
  
  prima = []  #empty list
  
  def Bsearch(lsta,low,high,search):   #Binary search function to search a prime number
      if low&gt;high:
          return 0
      else:
          mid = int((low+high)/2)
  
          if search&lt;lsta[mid]:
              Bsearch(lsta,low,mid-1,search)
          if search&gt;lsta[mid]:
              Bsearch(lsta,mid+1,high,search)
          if search==lsta[mid]:
              return 1
      return 0
  
  def primes(LIMIT):   #sieve to create prime numbers upto LIMIT
      dic = {}    #empty dictionary
      for i in range(2,LIMIT):
          dic[i] = 1
      for i in range(2,LIMIT):
          for j in range(i,LIMIT):
              if i*j&gt;LIMIT:
                  break
              dic[i*j] = 0
      for i in range(2,LIMIT):
          if dic[i]==1:
              prima.append(i)
  
  primes(LIMIT)
  
  result = []
  
  for i in range(0,len(prima)):
      print(str((i/len(prima)*100))+"% list passed")
  
      tempa = []
      tempa.append(prima[i])
      count = 0
      for j in range(i+1,len(prima)):
          c1 = int(str(prima[j])+str(prima[i]))   #first combination
          c2 = int(str(prima[i])+str(prima[j]))   #second combination
          if(Bsearch(prima,0,len(prima)-1,c1) and Bsearch(prima,0,len(prima)-1,c2)):
              print("small success : "+str(count))
              tempa.append(prima[j])
              count +=1
          if(count==4):
              result.append(tempa)
              print("success!")
              break
  
  for item in result:
      print(item)
  </code></pre>