Are you lucky enough to find these lucky numbers?

A natural number a a is called a lucky number if the sum of its digits is 7. Arrange all lucky numbers in an ascending order, and we get a sequence a 1 , a 2 , a 3 , a_1 , a_2 , a_3 , \ldots . If a n = 2005 a_n = 2005 , compute a 5 n a_{5n} .


The answer is 52000.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Kyle T
Feb 19, 2019

using this php code I was able to generate all lucky numbers (remember that arrays start at 0, so I preloaded the number 0 so our first lucky number 7 sits at $lucky[1]):

<?php
$lucky = array(0);
for($i=1;$i<1000000;$i++){
if(array_sum(str_split($i))==7){
$lucky[] = $i;
}
}
echo '<pre>'.print_r($lucky,true).'</pre>';
?>


From here, we are able to see that $lucky[65]=2005 , so 65 is n
We are asked to find 5n, and 65*5=325
Therefore we are asked to find $lucky[325] which we can see is 52000

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...