A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.

Forum rules
As your posts will be visible to the general public you
are requested to be thoughtful in not posting anything
that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one

Problem 684 (View Problem)
Hi,
I haven't solved this yet, but I noticed that the example number has the same quotient and remainder when divisible by 9, so it's impossible to tell using it alone if you have made a mistake in entering one of these into the solution.

I can't solve it because, try I might, I haven't found enough tricks to calculating the numbers in a reasonable time and without overflow. I have done modulo operations after each addition and multiplication, tried (and abandoned in favour of built-ins) a method of modular exponentiation which cancels out much of the multiplying by setting the relevant exponents mod x to 1, and found closed form expressions for the sums. The limit is the exponentiations. What, besides maybe the F's thm, can speed this up? It may be finished yet by this time next year at this rate.

RudiGj wrote: ↑Sat Jan 04, 2020 12:04 am
Do you have to find the smallest digit sum for each term of the fibonacci sequence from the 2nd to the 90th?

No, that is not correct. $S(n)$ is not digitsum.
Instead, $s(n)$ is the inverse digit sum, so $\mathrm{digitsum}(s(n)) = n$.
Note also that $S$ is the sum of $s$.

So, (given a Fibonacci number $f_i$), you have to find the smallest number whose digit sum is $n$, for each number $n$ up to $f_i$. Their sum gives you $S(f_i)$.
Then the answer would be: $S(1) + S(2) + S(3) + S(5) + S(8) + ... + S(f_{90})$.

hk wrote: ↑Mon Apr 13, 2020 1:13 pm
Please have a look at the fastest solvers table....

True, there are some quick solutions but they all revolve around figuring out the mathematics. Once done the coding is simple. How do you balance mathematical know-how against coding ability? Problem 243 was similar - it was easy if you got your head around the maths. (I was much more familiar with the mathematics required for that problem!)

I still wouldn't put this problem in the same category with problems 53 and 55 for example!

I have what I think is a correct algorithm for this problem but my answer is not being accepted.

RobertStanforth wrote: ↑Sat Jan 04, 2020 9:04 am
So, (given a Fibonacci number $f_i$), you have to find the smallest number whose digit sum is $n$, for each number $n$ up to $f_i$. Their sum gives you $S(f_i)$.
Then the answer would be: $S(1) + S(2) + S(3) + S(5) + S(8) + ... + S(f_{90})$.

Is this right? From the problem description the answer should be given by
$S(f_2) + S(f_3) + ... + S(f_{90})$

RudiGj wrote: ↑Sat Jan 04, 2020 12:04 am
Do you have to find the smallest digit sum for each term of the fibonacci sequence from the 2nd to the 90th?

No, that is not correct. $S(n)$ is not digitsum.
Instead, $s(n)$ is the inverse digit sum, so $\mathrm{digitsum}(s(n)) = n$.
Note also that $S$ is the sum of $s$.

So, (given a Fibonacci number $f_i$), you have to find the smallest number whose digit sum is $n$, for each number $n$ up to $f_i$. Their sum gives you $S(f_i)$.
Then the answer would be: $S(1) + S(2) + S(3) + S(5) + S(8) + ... + S(f_{90})$.

codingclubwaseesucks wrote: ↑Sat Jul 04, 2020 6:51 pm
Could you clarify what you mean about "Instead, s(n) is the inverse digit sum, so digitsum(s(n))=n"?
What is an Inverse Digit Sum?

Let digitsum(x) be the sum of the digits of the number x. For example, digitsum(19) = 10. An inverse function would reverse that. If the sum of the digits is 10, what is the number. Without the restriction, "the smallest number," there would be lots answers With the restriction, we can say 19 is the smallest number with a digit sum of 10. That is what is meant by an Inverse Digit Sum.

In the problem, n is the digit sum, and s(n) is the smallest number whose digits sum to n. digitsum(19) = 10 and s(10) = 19.

Generalise the problem such that F(N) = S(f_{2}) + ... + S(f_{N}).

I have a (slow) brute force algorithm, a medium algorithm and a fast algorithm. They all agree as far as I can push the slower ones, which is up to F(22) for the brute force and F(46) for the medium algorithm.

The brute force and medium algorithm both agree with S(20) = 1074 (the fast one only works on Fibonacci inputs).

My answer for F(90) is apparently not correct.

Is anyone willing to verify a couple of intermediate results?

PurpleBlu3s wrote: ↑Thu Dec 31, 2020 6:15 pm
Is anyone willing to verify a couple of intermediate results?

I'd be willing to do some cross verification with you. I haven't solved it yet either but I believe I have it running correctly so far up to the mid-30 of fibonacci numbers. Feel free to pm me on here.

PurpleBlu3s wrote: ↑Thu Dec 31, 2020 6:15 pm
The brute force and medium algorithm both agree with S(20) = 1074 (the fast one only works on Fibonacci inputs).

I think it's a legitimate hint to say that there's nothing special about Fibonacci inputs. My best guess is that the question asks for the particular Fibonacci-based sum that it does as a way of making the calculation expensive enough to trip up brute force solutions without using inputs that don't fit in a 64-bit integer.