2

I have $n = 1234a + 56b + 7c$.

Is there a way to check if a triplet $(a,b,c)$ exists, such that all three are non-negative?

Harry Peter
  • 7,819

1 Answers1

3

Essentially, as Arthur mentions in the comments, this is a version of the Coin problem, finding out which values $n$ can be achieved using coins of value $1234, 56,$ and $7$.

The coin of value $56$ (and hence the variable $b$) does not change which values of $n$ are possible, as any value of $b$ can also be achieved by modifying the value of $c$ (since $7 \mid 56$). This simplifies the analysis to a two coin problem for which the answer is well-described in the wikipedia article.

However to go through the process, it's apparent that only multiples of $7$ are possible for $n<1234$. Above that, since $1234 \equiv 2 \bmod 7$, values of $n \equiv k \in \{0,2\} \bmod 7$ are possible up to $2468$, which then opens up $n\equiv 4 \bmod 7$, etc until $6\times 1234 = 7404$ fills the last gap of $n \equiv 5 \bmod 7$. The $6$ values prior to that are also achievable, of course, so the largest number for which there is no non-negative $(a,b,c)$ combination possible is $n=7404-7 = 7397$.

Joffan
  • 39,627
  • If the constant $56$ in the problem were replaced with some other number roughly the same size but not divisible by $7$ - say, $65$ - then this would mean the variable $a$ could be disregarded since any multiple of $1234$ could easily be comprised of a suitable combination of the two smaller constants. – Joffan Jun 14 '16 at 21:21