1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# [[2017-03-10] Challenge #305 [Hard] Numbers for Sale](https://www.reddit.com/r/dailyprogrammer/comments/5yoo87/20170310_challenge_305_hard_numbers_for_sale/)
## Description
KimCo Global, the global corporation from DPRK, is secretly developing an
awesome new product for its loyal costumers called Number. It is what is says
- Number, but not just any Number, each Number is a unique positive integer.
Each number costs its value - so 1 costs $1, 5 costs $5, etc. KimCo Global puts
each number from 1 to 10^15 on sale.
Your friend, a salesman for KimCo Global, needs your help to optimize their
profits. He received all available Numbers whose sum of digits equals 69 and
seeks to sell them for the highest value he can. His regular accountant is of
no help, can you assist?
What is the total of positive integers less than 10^15 whose sum of digits
equal 69?
## Credit
This challenge was suggested by user /u/raluralu, many thanks. If you have any
challenge ideaas, please do share them on /r/dailyprogrammer_ideas and there's
a good chance we'll use them.
## EDIT 2017-03-11
There's been some discussion about the ambiguity of this challenge - is it
asking for the *sum* of all of those Numbers or the *quantity* of Numbers that
fit the constraint? I have to admit the original submission from
/r/dailyprogrammer_ideas was also a bit ambiguous. I believe the submitter who
wrote it does not speak English natively, and so they had some ambiguity in
their presentation. As such, I copied their question complete with ambiguity.
Because of this, I think either will be fine - the sum or the quantity.
The real challenge, and why this is a Friday hard one, is writing a better than
naive solution as some of you have picked up. Some of it is math and some of it
is programming.
|