Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,987 questions

51,931 answers

573 users

How to find the numbers that are the sum of fifth powers of their digits in VB.NET

1 Answer

0 votes
Imports System
				
Module DigitPowerSum

    ' Computes the sum of the fifth powers of the digits of n
    Function SumOfFifthPowers(n As Integer) As Integer
        Dim sum As Integer = 0
        Dim temp As Integer = n

        While temp > 0
            Dim digit As Integer = temp Mod 10
            sum += digit ^ 5
            temp \= 10
        End While

        Return sum
    End Function

    Sub Main()
        For i As Integer = 1000 To 999999
            If i = SumOfFifthPowers(i) Then
                Console.WriteLine(i)
            End If
        Next
    End Sub

End Module



' run:
'
' 4150
' 4151
' 54748
' 92727
' 93084
' 194979
' 

 



answered Nov 9, 2025 by avibootz
...