Microsoft Small Basic

Problem 30 solution

Modified: 2012/01/31 12:37 by 80.254.75.12 - Categorized as: Errors
If we have a 3 digit number then the maximum sum of the digits to fifth power is 95+95+95 = 3*95 = 177147

If we check the maximum sum of the digits to fifth power for different numbers of digits we find that the maximum number of digits is 6. For larger numbers with more digits, the maximum sum to 5th powers will always be less than the number.

This limits our search to 6 digit numbers.

Still, we mustn't forget to remove 1=1^5 from our result in the end, because since it's not a sum, it's not considered in the result.

For d = 1 To 10
  TextWindow.WriteLine("Max sum of "+d+" digit number to 5th power = "+d*9*9*9*9*9)
EndFor

total = 0
For d1 = 0 To 9
  s1 = d1*d1*d1*d1*d1
  For d2 = 0 To 9
    s2 = d2*d2*d2*d2*d2
    For d3 = 0 To 9
      s3 = d3*d3*d3*d3*d3
      For d4 = 0 To 9
        s4 = d4*d4*d4*d4*d4
        For d5 = 0 To 9
          s5 = d5*d5*d5*d5*d5
          For d6 = 0 To 9
            s6 = d6*d6*d6*d6*d6
            sum = s1+s2+s3+s4+s5+s6
            number = 100000*d1+10000*d2+1000*d3+100*d4+10*d5+d6
            If (sum = number) Then
              TextWindow.WriteLine("Solution found = "+number)
              total = total+number
            EndIf
          EndFor
        EndFor
      EndFor
    EndFor
  EndFor
EndFor

total = total - 1

TextWindow.WriteLine("Total = "+total)

The answer after a few seconds of calculation is 443839 beauty tips beauty make-up * buy backlinks * backlink services * edu links * link building services * google backlinks * windows 8

best diet pills Century 21 Broker Properti Jual Beli Sewa Rumah Indonesia

Edit

Read More

Contoh Surat Pengunduran Diri Contoh surat lamaran kerja Contoh daftar riwayat hidup Status lucu Kata Kata Gombal Kata kata galau Kata Kata Gombal OVj Model Rambut 2012

ScrewTurn Wiki version 2.0.35. Some of the icons created by FamFamFam.