### Challenge: Digit Fifth Powers

Posted on: August 23, 2017 11:28:58 PM

Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:

1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44

As 1 = 14 is not a sum it is not included.

The sum of these numbers is 1634 + 8208 + 9474 = 19316.

Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.

This is another relatively straight forward challenge where a modified brute force approach is fastest. I cached the 0-9 fifth powers so they wouldn't always need to be calculated and based on those results, it was clear that a good starting point was 35 since there was no possible way it could be anything between 25 and 35. The next step is finding an upper bound. I started by taking 5x95 and found that the result contained 6 digits. So I put the upper bound to 6x96 to support the 6 digits. The rest is just letting it loop and finding if the on going sum is larger than the initial number.
Program.cs
```using System;
using System.Diagnostics;

namespace Project_Euler_30
{
internal class Program
{
// 5x9^5 has 6 digits, so the upper bound should be 6x9^6
private const int UpperBound = 59049 * 6;

private static readonly int[] powersCache = new int[] { 0, 1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049 };

private static void Main(string[] args)
{
Stopwatch sw = Stopwatch.StartNew();
int result = 0;

// start the loop at 243 since that is the lower bound (3^5) of a possible sum
for(int i = powersCache[3]; i <= UpperBound; i++)
{
int sum = 0;
int workingNumber = i;

while(workingNumber > 0)
{
int digit = workingNumber % 10;
workingNumber /= 10;

sum += powersCache[digit];

if(sum > i)
{
// passed the number, stop checking
break;
}
}

if(sum == i)
{
result += i;
}
}
sw.Stop();

Console.WriteLine(\$"Sum of results: {result}");
Console.WriteLine(\$"Took {sw.ElapsedMilliseconds}ms");
}
}
}
```

look at this

Lien December 16, 2021 7:41:39 AM

трейлер фильма человек паук нет пути домой Сколько Сцен После Титров Человек Паук Нет Пути Домой http://m-dnc.com/web/1NMP0DDg/

Tristan August 27, 2022 3:42:36 AM

gay senior chat [url="https://chatcongays.com"]gay page chat roulette[/url] miami downtown chat gay

GenniesrPa September 16, 2022 1:13:17 AM

free live gay webcam chat rooms [url="https://chatcongays.com"]gay video chat apps ios[/url] gay masturbate chat

GenniesrPa September 16, 2022 3:41:16 AM

gay chat 877 *** 7000 [url="https://chatcongays.com"]gay teen cam chat[/url] zoom chat rooms gay chat

GenniesrPa September 16, 2022 6:31:27 AM

my essay writer [url="https://au-bestessays.org"]cheap essay online[/url] buy essay cheap online

MarrissrPa September 20, 2022 12:22:22 AM

essay writing helper [url="https://au-bestessays.org"]cheap essay online[/url] the best custom essay writing service

MarrissrPa September 20, 2022 12:25:55 AM

MarrissrPa September 20, 2022 1:08:16 AM

essay writers for pay [url="https://bestcampusessays.com"]scholarship essay writing help[/url] essay writer

DorolisasrPa September 20, 2022 7:35:47 PM

admission essay editing service [url="https://bestcampusessays.com"]college essay help[/url] best admission essay editing service

DorolisasrPa September 20, 2022 7:39:43 PM

best essay help review [url="https://bestcampusessays.com"]do essay writing services work[/url] best essay writing company

DorolisasrPa September 20, 2022 8:19:56 PM

essay writer cheap [url="https://besteasyessays.org"]buy an essay cheap[/url] custom essay writing help

MartysrPa September 21, 2022 5:55:46 PM

help in writing essay [url="https://besteasyessays.org"]cheap essays[/url] the essay writer

MartysrPa September 21, 2022 5:59:27 PM

help writing a comparison and contrast essay [url="https://besteasyessays.org"]legitimate essay writing services[/url] cheap essay online

MartysrPa September 21, 2022 6:40:23 PM

where to buy essays [url="https://bestessayreviews.net"]essay help websites[/url] write my college essay me

MerolasrPa September 22, 2022 1:51:06 PM

custom application essay [url="https://bestessayreviews.net"]essay writer helper[/url] best website for essays

MerolasrPa September 22, 2022 1:55:25 PM

service essay [url="https://bestessayreviews.net"]can someone write my essay[/url] custom essay station

MerolasrPa September 22, 2022 2:42:08 PM

mba essay writing services [url="https://bestessaysden.com"]best college essay editing service[/url] best online essay writer

AshlensrPa September 23, 2022 9:38:21 AM

buy custom essay [url="https://bestessaysden.com"]cheap essay services[/url] essay service

AshlensrPa September 23, 2022 9:42:18 AM

custom essays service [url="https://bestessaysden.com"]help writing a essay[/url] best essay service

AshlensrPa September 23, 2022 10:26:15 AM

essay writing on customer service [url="https://bestsessays.org"]essay writing service usa[/url] write my essay review

CharitasrPa September 24, 2022 11:17:10 PM

romeo and juliet essay help [url="https://bestsessays.org"]best custom essay writing service[/url] essay writing service best

CharitasrPa September 24, 2022 11:20:06 PM

top essay writing services [url="https://bestsessays.org"]pay for essay cheap[/url] essay custom writing

CharitasrPa September 25, 2022 12:00:40 AM

higher english critical essay help [url="https://buyacademicessay.com"]custom essay service toronto[/url] who will write my essay for me

NanicesrPa September 25, 2022 6:15:01 PM

NanicesrPa September 25, 2022 6:18:21 PM

NanicesrPa September 25, 2022 7:00:29 PM

essay paper writing help [url="https://buy-eessay-online.com"]college essay help nyc[/url] reviews of essay writing services

ChelsaesrPa September 26, 2022 1:55:31 PM

english essay writers [url="https://buy-eessay-online.com"]best custom essay website[/url] help essays

ChelsaesrPa September 26, 2022 2:40:02 PM

custom essay paper writing [url="https://buytopessays.com"]write my essay for money[/url] help me essay

PennysrPa September 27, 2022 9:02:10 AM

PennysrPa September 27, 2022 9:06:53 AM

help with writing essays [url="https://buytopessays.com"]what is the best custom essay writing service[/url] essay writers online

PennysrPa September 27, 2022 9:50:29 AM

best essay website [url="https://cheapessaywritingservice1.com"]cheap essay writing service usa[/url] custom essay services

TammiesrPa September 28, 2022 4:55:31 AM

help writing a college essay [url="https://cheapessaywritingservice1.com"]essay help 123[/url] essay writer website

TammiesrPa September 28, 2022 5:36:32 AM

professional custom essays [url="https://customcollegeessays.net"]essay writing service cheap[/url] where to buy essays

AntoniesrPa September 29, 2022 12:55:09 AM

can someone write my essay [url="https://customcollegeessays.net"]buy essay online cheap[/url] essay writing service us

AntoniesrPa September 29, 2022 1:34:57 AM

how to write my essay [url="https://customessays-writing.org"]custom essay help[/url] college essay editing services

RhiamonsrPa September 29, 2022 8:29:54 PM

write my history essay [url="https://customessays-writing.org"]help with my essay[/url] best essay help review

RhiamonsrPa September 29, 2022 8:33:55 PM

professional essay writers review [url="https://customessays-writing.org"]essay custom writing[/url] top ten essay writing services

RhiamonsrPa September 29, 2022 9:11:47 PM

essay writing assignment help [url="https://customessaywwriting.com"]essay writing help[/url] buy essay writing online

CharosrPa September 30, 2022 3:26:23 PM

buy essay paper [url="https://customessaywwriting.com"]essay correction service[/url] online essay writers

CharosrPa September 30, 2022 4:02:54 PM

higher english critical essay help [url="https://customs-essays-writing.org"]professional college essay writers[/url] buy college essays

DronasrPa October 1, 2022 9:56:59 AM

assignment essay help [url="https://customs-essays-writing.org"]essay writers online[/url] help with argumentative essay

DronasrPa October 1, 2022 10:01:19 AM

essay writing service ratings [url="https://customs-essays-writing.org"]cheapest essay writing service[/url] critical essay help

DronasrPa October 1, 2022 10:43:57 AM

buy essay [url="https://firstessayservice.net"]essays services[/url] top 10 essay writing services

TwylasrPa October 2, 2022 5:28:19 AM

top essay writing websites [url="https://firstessayservice.net"]buy custom essay[/url] who will write my essay for me

TwylasrPa October 2, 2022 6:12:20 AM

best essays writing service [url="https://geniusessaywriters.net"]best essay writer[/url] best essay writing service

LeilahsrPa October 3, 2022 2:13:19 AM

customer service essays [url="https://geniusessaywriters.net"]custom essay writing cheap[/url] what is the best custom essay site

LeilahsrPa October 3, 2022 2:17:01 AM

essays writing service [url="https://geniusessaywriters.net"]custom essay writing service[/url] help with my essay

LeilahsrPa October 3, 2022 2:58:02 AM

best custom essay website [url="https://howtobuyanessay.com"]help writing a college essay[/url] custom essays essay help

CthrinesrPa October 4, 2022 12:08:14 AM

essay help 123 [url="https://howtobuyanessay.com"]help with writing a essay[/url] best essay writing websites

CthrinesrPa October 4, 2022 12:12:11 AM

essay on service to humanity [url="https://howtobuyanessay.com"]write my essay review[/url] hire essay writer

CthrinesrPa October 4, 2022 12:50:38 AM

cheap custom essay [url="https://lawessayhelpinlondon.com"]college essay help nyc[/url] help writing a argumentative essay

GinniesrPa October 9, 2022 12:05:04 PM

college application essay writers [url="https://lawessayhelpinlondon.com"]online essay writer[/url] uc essay help

GinniesrPa October 9, 2022 12:45:06 PM

VivienesrPa October 11, 2022 6:25:29 PM

essay writing help online [url="https://ukessayservice.net"]essay writing on customer service[/url] online essay services

VivienesrPa October 11, 2022 7:03:15 PM

help 123 essay [url="https://writemyessaycheap24h.com"]college application essay editing services[/url] graduate school essay writing service

EastersrPa October 13, 2022 9:24:53 AM

help on essay writing [url="https://writemyessaycheap24h.com"]essay homework help[/url] write my essay south park

EastersrPa October 13, 2022 10:08:00 AM

https://prednisoneall.top/

QhcUCDC October 30, 2022 5:54:05 PM

https://prednisoneall.top/

QiaMHXS October 31, 2022 11:31:23 AM

custom essay online [url="https://bestcampusessays.com"]essay help live chat[/url] essaywriting service

DorolisasrPa November 19, 2022 7:15:31 AM

write my essay for me no plagiarism [url="https://besteasyessays.org"]essay writers cheap[/url] buy cheap essays

MartysrPa November 20, 2022 1:02:06 PM

online essay writer [url="https://besteasyessays.org"]pay for essay cheap[/url] instant essay writer

MartysrPa November 20, 2022 1:06:52 PM

online custom essays [url="https://besteasyessays.org"]college admission essay editing services[/url] online essay editing service

MartysrPa November 20, 2022 2:05:33 PM

buy essays online reviews [url="https://bestessayreviews.net"]academic essay service[/url] i need help writing a essay

MerolasrPa November 21, 2022 8:51:07 PM

help me with my essay [url="https://bestessayreviews.net"]using essay writing service[/url] help writing my college essay

MerolasrPa November 21, 2022 8:56:28 PM

college application essay service [url="https://bestessayreviews.net"]common app essay help[/url] professional essay writers for hire

MerolasrPa November 21, 2022 9:52:26 PM

help with writing college essays [url="https://bestessaysden.com"]essay writing company reviews[/url] service to others essay

AshlensrPa November 23, 2022 5:44:52 AM

help me do my essay [url="https://bestessaysden.com"]who can i pay to write my essay[/url] need help with essay writing

AshlensrPa November 23, 2022 5:50:03 AM

custom essay station [url="https://bestsessays.org"]definition essay help[/url] help with essay papers

CharitasrPa November 24, 2022 1:25:06 PM

where to buy essays [url="https://bestsessays.org"]essay on help[/url] custom essay writing reviews

CharitasrPa November 24, 2022 1:30:21 PM

personal essay help [url="https://bestsessays.org"]pay to write my essay[/url] cheap essay

CharitasrPa November 24, 2022 2:27:59 PM

NanicesrPa November 25, 2022 10:47:39 PM

i need help writing a descriptive essay [url="https://buyacademicessay.com"]essays writing help[/url] scholarship essay writing service

NanicesrPa November 25, 2022 11:50:20 PM

cheap essays online [url="https://buy-eessay-online.com"]english literature essay help[/url] application essay writing service

ChelsaesrPa November 27, 2022 7:59:51 AM

essay writing company reviews [url="https://buy-eessay-online.com"]write my social work essay[/url] buying essays online

ChelsaesrPa November 27, 2022 9:14:59 AM

best essay help review [url="https://buytopessays.com"]custom law essays[/url] write my essay custom writing

PennysrPa November 28, 2022 5:12:00 PM

PennysrPa November 28, 2022 5:18:21 PM

english literature essay help [url="https://buytopessays.com"]essay help pros[/url] top custom essay services

PennysrPa November 28, 2022 6:24:28 PM

Contact Me
Recent Blog Activity
Blog Archive