N heart

We define n n\heartsuit recursively as follows. 1 = 1 ; n = ( ( n 1 ) ) n + 1 1\heartsuit =1;\ n\heartsuit = ((n-1)\heartsuit)\cdot n +1 Find the largest n < 1000 n<1000 such that the last two digits of n n\heartsuit are zeroes.

Details and assumptions

Just to make it clear: unlike "n-factorial," "n-heart" is NOT an official mathematical terminology.

Clarification: There is no restriction / requirements on the third last digit.

Clarification: We can calculate that 2 = ( 1 ) 2 + 1 = 1 2 + 1 = 3 2 \heartsuit = (1\heartsuit) \cdot 2 + 1 = 1 \cdot 2 + 1 = 3 and 3 = ( 2 ) 3 + 1 = 3 3 + 1 = 10 3 \heartsuit = ( 2 \heartsuit) \cdot 3 + 1 = 3 \cdot 3 + 1 = 10 .


The answer is 919.

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.

3 solutions

We have to find a n n such that 100 n 100 \mid n♡ . Note that 100 n 4 n and 25 n 100 \mid n♡ \iff 4 \mid n♡ \text{ and } 25 \mid n♡ Let's first try to find the set of positive integers n n such that n 0 ( m o d 4 ) n♡ \equiv 0 \pmod{4} . To do this, let's write down the first few residues of n ( m o d 4 ) n♡ \pmod{4} :
Here's the link in case the image doesn't load:http://s8.postimg.org/iob62zp6d/Untitled.png Here's the link in case the image doesn't load:http://s8.postimg.org/iob62zp6d/Untitled.png
In the table above, note that 4 8 ( m o d 4 ) 4♡ \equiv 8♡ \pmod{4} . We shall now prove by induction that for all n 4 n \geq 4 , n ( n + 4 ) ( m o d 4 ) n♡ \equiv (n+4)♡ \pmod{4} . The base case n = 4 n=4 has already been shown. Assume our assertion is true for some k 4 k \geq 4 , so k ( k + 4 ) ( m o d 4 ) k♡ \equiv (k+4)♡ \pmod{4} . Then, note that ( k + 1 ) ( k + 1 ) × k + 1 ( m o d 4 ) (k+1)♡ \equiv (k+1) \times k♡ + 1 \pmod{4} ( k + 1 ) × ( k + 4 ) + 4 × ( k + 4 ) + 1 ( m o d 4 ) \equiv (k+1) \times (k+4)♡ + 4 \times (k+4)♡ + 1 \pmod{4} ( k + 5 ) × ( k + 4 ) + 1 ( k + 5 ) ( m o d 4 ) \equiv (k+5)\times ( k+4)♡ + 1 \equiv (k+5)♡ \pmod{4} This completes our induction step, and hence our claim is true for all n 4 n \geq 4 . Thus, the residues of n ( m o d 4 ) n♡ \pmod{4} become periodic with periodicity 4 4 . From the table above, we have 7 0 ( m o d 4 ) 7♡ \equiv 0 \pmod{4} , so for all n 4 n \geq 4 , n 0 ( m o d 4 ) n 7 3 ( m o d 4 ) n♡ \equiv 0 \pmod{4} \iff n \equiv 7 \equiv 3 \pmod{4} .

Similarly, we calculate the first 40 40 residues of n ( m o d 25 ) n♡ \pmod{25} :
Here's the link in case the image doesn't load:http://s11.postimg.org/vb7ee4ur7/Untitled.png Here's the link in case the image doesn't load:http://s11.postimg.org/vb7ee4ur7/Untitled.png
Here's the link in case the image doesn't load:http://s15.postimg.org/3pedf06aj/Untitled.png Here's the link in case the image doesn't load:http://s15.postimg.org/3pedf06aj/Untitled.png
Note that 15 45 ( m o d 25 ) 15♡ \equiv 45♡ \pmod{25} . Similarly, we shall prove by induction that for all n 15 n \geq 15 , n ( n + 25 ) ( m o d 25 ) n♡ \equiv (n+25)♡ \pmod{25} . The base case n = 15 n=15 has already been shown. Assume our assertion is true for some k 15 k \geq 15 , so k ( k + 25 ) ( m o d 25 ) k♡ \equiv (k+25)♡ \pmod{25} . Then, note that ( k + 1 ) ( k + 1 ) × k + 1 ( m o d 25 ) (k+1)♡ \equiv (k+1) \times k♡ + 1 \pmod{25} ( k + 1 ) × ( k + 25 ) + 25 × ( k + 25 ) + 1 ( m o d 25 ) \equiv (k+1) \times (k+25)♡ + 25 \times (k+25)♡ + 1 \pmod{25} ( k + 26 ) × ( k + 25 ) + 1 ( k + 26 ) ( m o d 25 ) \equiv (k+26) \times (k+25)♡ + 1 \equiv (k+26)♡ \pmod{25} This completes the induction step, and hence our claim is true for all n 15 n \geq 15 . Thus, the residues of n ( m o d 25 ) n♡ \pmod{25} become periodic with periodicity 25 25 . From the table above, note that n n♡ is zero for n = 32 n=32 and n = 44 n=44 . Hence, for all n 15 n \geq 15 , 25 n n 32 / 44 ( m o d 25 ) n 7 / 19 ( m o d 25 ) 25 \mid n♡ \iff n \equiv 32/44 \pmod{25} \implies n \equiv 7/19 \pmod{25} .

Solving the congruencies n 7 ( m o d 25 ) n \equiv 7 \pmod{25} , n 3 ( m o d 4 ) n \equiv 3 \pmod{4} by CRT, we get n 7 ( m o d 100 ) n \equiv 7 \pmod{100} .
Again, solving the congruencies n 7 ( m o d 25 ) n \equiv 7 \pmod{25} , n 3 ( m o d 4 ) n \equiv 3 \pmod{4} by CRT, we get n 19 ( m o d 100 ) n \equiv 19 \pmod{100} .
To conclude, 100 n n 7 / 19 ( m o d 100 ) 100 \mid n♡ \iff n \equiv 7/19 \pmod{100} . The largest number 7 ( m o d 100 ) \equiv 7 \pmod{100} in the range [ 1 , 1000 ] [1,1000] is 907 907 , and the largest number 19 ( m o d 100 ) \equiv 19 \pmod{100} in the range [ 1 , 1000 ] [1,1000] is 919 919 . Our desired answer will be 919 \boxed{919} .

Great writeup!

The fact that it's not immediately periodic means that we have to be very careful with the arguments presented.

Though, you should be careful with your final claim. Remember that you needed to use the fact that n 4 n \geq 4 (first claim) and n 15 n \geq 15 (second claim), hence your result only holds for n 15 n \geq 15 . In particular, f 7 ≢ 0 ( m o d 100 ) f_7 \not \equiv 0 \pmod{100} .

Calvin Lin Staff - 7 years, 7 months ago

Log in to reply

Yes sir, sorry for that. The final claim should be:
> To conclude, 100 n , n 15 n 7 / 19 ( m o d 100 ) 100 \mid n \heartsuit, n \geq 15 \iff n \equiv 7/19 \pmod{100}

(I believe by f n f_n you mean n n \heartsuit ) But note that since we are interested in the largest value of n n in the range [ 1 , 1000 ] [1, 1000] and there exist solutions for n > 15 n>15 , this doesn't change the answer (which is why I got the correct answer as the result).

I messed up in the induction step for proving k ( k + 25 ) ( m o d 25 ) ( k + 1 ) ( k + 26 ) ( m o d 25 ) k \heartsuit \equiv (k+25) \heartsuit \pmod{25} \implies (k+1) \heartsuit \equiv (k+26) \heartsuit \pmod{25} , where I used n 15 n \geq 15 , n 20 n \geq 20 and n 45 n \geq 45 interchangeably. Can you please correct it?

Sreejato Bhattacharya - 7 years, 7 months ago

Log in to reply

I've changed it all to n 15 n \geq 15 (though your statements still hold true).

As a side note, it is true for n 10 n \geq 10 , so that would be the better induction hypothesis, since it covers all cases and people won't be wondering "Why did he leave out 10, 11, 12, 13, 14".

Calvin Lin Staff - 7 years, 7 months ago

Log in to reply

@Calvin Lin Oh, so sorry for that. The periodicity indeed occurs after n = 10 n=10 , but I didn't notice this. I had to go through unnecessary case checking for 5 5 numbers.

Sreejato Bhattacharya - 7 years, 7 months ago

Typo: Note that 15 40 ( m o d 25 ) 15♡ \equiv 40♡ \pmod{25} , which has been used in our base case. Our assertion is in fact true for all n 15 n \geq 15 .

Sreejato Bhattacharya - 7 years, 7 months ago
Matt McNabb
Oct 29, 2013

I'm going to use f n f_n instead of n-heart , not sure how to write the heart :)

Firstly let's have a non-recursive definition for f n f_n : f n = i = 1 n n ! i ! f_n = \sum_{i=1}^{n}{n! \over i!}

We can readily check that this satisfies the definition of n-heart.

Lemma: f n + k ( f n + n ! ) m o d k f_{n+k} \equiv (f_n + n!) \mod k

Proof: We have f n + k = i = 1 n + k ( n + k ) ! i ! f_{n+k} = \sum_{i=1}^{n+k}{(n+k)! \over i!} All terms with i < k i \lt k are clearly 0 m o d k \equiv 0 \mod k . So, letting j = i k j = i - k , we get f n + k j = 0 n n ! j ! m o d k j = 1 n n ! j ! + n ! f n + n ! \begin{aligned} f_{n+k} &\equiv \sum_{j=0}^{n}{n! \over j!} \mod k\\ &\equiv \sum_{j=1}^{n}{n! \over j!} + n! \\ &\equiv f_n + n! \end{aligned}

Now, we need to solve f n 0 m o d 100 f_n \equiv 0 \mod 100 . By the Chinese Remainder Theorem we can solve this in two parts: f n 0 m o d 4 f_n \equiv 0 \mod 4 and f n 0 m o d 25 f_n \equiv 0 \mod 25 , since 4 4 and 25 25 are coprime.

If f n 0 m o d 4 f_n \equiv 0 \mod 4 then repeated application of the lemma tells us that f n f n m o d 4 + n ! m o d 4 f_n \equiv f_{n \mod 4} + n! \mod 4 . So we just need to compute f n + n ! f_n + n! for n = 1 , 2 , 3 , 4 n = 1, 2, 3, 4 (I choose this range to avoid using f 0 f_0 ), and we find: f 1 + 1 ! = 2 f 2 + 2 ! = 5 f 3 + 3 ! = 16 f 4 + 4 ! = 65 \begin{aligned} f_1 + 1! &= 2 \\ f_2 + 2! &= 5 \\ f_3 + 3! &= 16 \\ f_4 + 4! &= 65 \end{aligned}

So we must have n 3 m o d 4 n \equiv 3 \mod 4 .

We can solve f n + n ! 0 m o d 25 f_n + n! \equiv 0 \mod 25 in the same way. I did this by brute force, although it is not particularly brute considering that you can compute f n m o d 25 f_n \mod 25 up to f 25 f_{25} easily just by only keeping track of the last two digits; and since 10 ! 0 m o d 25 10! \equiv 0 \mod 25 we don't need to worry about n ! n! beyond the step f 9 + 9 ! f_9 + 9! .

It turns out that f 7 + 7 ! 0 m o d 25 f_7 + 7! \equiv 0 \mod 25 , and f 19 + 19 ! 0 m o d 25 f_{19} + 19! \equiv 0 \mod 25 , and no other solutions. So we have n 7 m o d 25 n \equiv 7 \mod 25 or n 19 m o d 25 n \equiv 19 \mod 25 .

So we have f n 0 m o d 100 f_n \equiv 0 \mod 100 if and only if n 7 or 19 m o d 25 n 3 m o d 4 n \equiv 7\mbox{ or }19 \mod 25 \\ n \equiv 3 \mod 4

Combining these two conditions gives n 7 or 19 m o d 100 n \equiv 7 \mbox{ or } 19 \mod 100 , so the biggest solution under 1000 1000 is 919 \boxed{919} .

You can use \heartsuit to type \heartsuit . I, however, pasted it directly from the problem statement. :)

Sreejato Bhattacharya - 7 years, 7 months ago

Interesting observation.

However, note that f 7 ≢ 0 ( m o d 100 ) f_7 \not \equiv 0 \pmod{100} which contradicts your final claim. There is a slight mistake in your logic that was used to arrive at the final step of

we have f n 0 ( m o d 100 ) f_n \equiv 0 \pmod{100} if and only if n 7 , 19 ( m o d 25 ) n \equiv 7, 19 \pmod{25} and n 3 ( m o d 4 ) n \equiv 3 \pmod{4} .

Calvin Lin Staff - 7 years, 7 months ago

Log in to reply

Re. f 7 f_7 , yes, I should have qualified the final few steps with n 10 n \ge 10 , i.e. the range where f n + n ! f n f_n + n! \equiv f_n . Thanks for putting in my correcting edit also. If there is another mistake I don't see it yet but hopefully someone can fill me in :)

Matt McNabb - 7 years, 7 months ago

Log in to reply

Can you explain where / how you used the condition that n 10 n \geq 10 ? It doesn't seem to be stated anywhere. Further note that if n 10 n \geq 10 is required in your lemma, then you need to do calculations of f 10 f_{10} to f 34 f_{34} , instead of just up to f 25 f_{25} .
The periodicity does happen after n = 10 n=10 , so adding in this detail will greatly help towards establishing the validity of your proof.

In the above comment, do you mean f n + n ! f n + k f_n + n! \equiv f_{n+k} (final subscript)?

I just corrected 2 instances of ( m o d 100 ) \pmod{100} into ( m o d 25 ) \pmod{25} in the earlier paragraph. Let me know if you would prefer for them to remain as 100.

Calvin Lin Staff - 7 years, 7 months ago

Log in to reply

@Calvin Lin f n + n ! m o d k f_n + n! \mod k is actually periodic with period k k , right from n = 1 n=1 .My proof actually shows that f n + n ! 0 m o d 100 f_n + n! \equiv 0 \mod 100 iff n 7 , 19 m o d 100 n \equiv 7,19 \mod 100 . And then we use the fact that n ! 0 m o d 100 n! \equiv 0 \mod 100 if n 10 n \ge 10 to show that if n 10 n \ge 10 then f n f n + n ! f_n \equiv f_n + n! .

Matt McNabb - 7 years, 7 months ago

Just out of curiosity, did the last solution get deleted? (the one with check 7 and 9 and 17 and 19)

Daniel Chiu - 7 years, 7 months ago

Log in to reply

We have removed a particular individual for behavior unbecoming of the Brilliant community. As a result, we have reversed some of his actions, to rectify the situation. This led to the solution being deleted.

Calvin Lin Staff - 7 years, 7 months ago

Yes. Probably because it was incomplete, yet rose to the top with the most number of upvotes.

Sreejato Bhattacharya - 7 years, 7 months ago

Could you explain the repeated application of the lemma portion. I'm not quite sure how you got from f n = 0 (mod 4) to f n = f_(n mod 4) + n! (mod 4)

Tony Wang - 7 years, 7 months ago

Log in to reply

For example, the lemma tells us f 15 f 11 + n ! f 11 m o d 4 f_{15} \equiv f_{11} + n! \equiv f_{11} \mod 4 , because n ! 0 m o d 4 n! \equiv 0 \mod 4 as long as n 4 n \ge 4 . Then the lemma says f 11 f 7 m o d 4 f_{11} \equiv f_7 \mod 4 , and again, f 7 f 3 + 3 ! m o d 4 f_7 \equiv f_3 + 3! \mod 4 .

Matt McNabb - 7 years, 7 months ago

I did it the same. Great work!

Cody Johnson - 7 years, 7 months ago

Log in to reply

If you did the same, can you figure out where the mistake is?

Calvin Lin Staff - 7 years, 7 months ago

Minor correction, the line "It turns out..." should read "It turns out that f 7 + 7 ! 0 m o d 25 f_7 + 7! \equiv 0 \mod 25 and f 19 + 19 ! 0 m o d 25 f_{19} + 19! \equiv 0 \mod 25 , and no other solutions", although they also happen to be 0 m o d 100 \equiv 0 \mod 100 .

Matt McNabb - 7 years, 7 months ago
Gabriel Wong
May 20, 2014

[Note: You might need to scroll right and left to view the full solution.]

If the last two digits are zeroes, this means that n n\heartsuit is congruent to 0 mod 25 and mod 4

Carefully writing out the congruences of n n\heartsuit modulo 25,

n 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 n ( m o d 25 ) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 0 n ( m o d 25 ) 1 3 10 16 6 12 10 6 5 1 12 20 11 5 1 17 15 21 0 1 22 10 6 20 1 n 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 n ( m o d 25 ) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 n ( m o d 25 ) 2 5 16 15 1 7 0 1 10 1 12 20 11 5 1 17 15 21 0 1 \begin{array} { c | c c c c c c c c c c c c c c c c c c c c c c c c c c c c } n & 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 \\ n \pmod{25} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 & 0\\ n \heartsuit \pmod{25} & 1 & 3 & 10 & 16 & 6 & 12 & 10 & 6 & 5 & 1 & 12 & 20 & 11 & 5 & 1 & 17 & 15 & 21 & 0 & 1 & 22 & 10 & 6 & 20 & 1 \\ \hline n & 26 & 27 & 28 & 29 & 30 & 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 & 41 & 42 & 43 & 44 & 45 \\ n \pmod{25} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20\\ n \heartsuit \pmod{25} & 2 & 5 & 16 & 15 & 1 & 7 & 0 & 1 & 10 & 1 & 12 & 20 & 11 & 5 & 1 & 17 & 15 & 21 & 0 & 1 \\ \end{array}

First observe that n ( n + 25 ) ( m o d 25 ) n\heartsuit \equiv (n+25) \heartsuit \pmod{25} for all n 15 n\geq 15 . We will prove this by induction.

Base case: We have 15 1 40 ( m o d 25 ) 15 \heartsuit \equiv 1 \equiv 40 \heartsuit \pmod{25} .

Induction step : If k ( k + 25 ) ( m o d 25 ) k \heartsuit \equiv (k+ 25 ) \heartsuit \pmod{25} , then ( k + 1 ) ( k ) × ( k + 1 ) + 1 ( k + 25 ) × ( k + 1 + 25 ) + 1 ( k + 26 ) ( m o d 25 ) (k+1) \heartsuit \equiv (k \heartsuit) \times (k+1) + 1 \equiv (k+25) \heartsuit \times (k+1+25) + 1 \equiv (k+26) \heartsuit \pmod{25} . Hence done.

Thus, for n 15 n \geq 15 , we know that n 0 ( m o d 25 ) n \heartsuit \equiv 0 \pmod{25} if and only if n 7 , 19 ( m o d 25 ) n \equiv 7, 19 \pmod{25} (check the above table).

For modulo 4, a similar observation holds. The congruences are:

n 1 2 3 4 5 6 7 8 9 10 11 12 n ( m o d 4 ) 1 2 3 0 1 2 3 0 1 2 3 0 n ( m o d 4 ) 1 3 2 1 2 1 0 1 2 1 0 1 \begin{array} { c | c c c c c c c c c c c c c c c c } n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & \\ n \pmod{4} & 1 & 2 & 3 & 0 & 1 & 2 & 3 & 0 & 1 & 2 & 3 & 0 \\ n \heartsuit \pmod{4} & 1 & 3 & 2 & 1 & 2 & 1 & 0 & 1 & 2 & 1 & 0& 1 \\ \end{array}

We can similarly show that for n 4 n \geq 4 , n ( n + 4 ) ( m o d 4 ) n \heartsuit \equiv (n+4) \heartsuit \pmod{4} , and that n 0 ( m o d 4 ) n \heartsuit \equiv 0 \pmod 4 if and only if n 3 ( m o d 4 ) n \equiv 3 \pmod {4} .

Combining the above using Chinese Remainder Theorem, we know that for n 15 n \geq 15 , n 0 ( m o d 100 ) n \heartsuit \equiv 0 \pmod {100} if and only if n 7 , 19 ( m o d 100 ) n \equiv 7, 19 \pmod{100} . Hence, the largest possible solution is 919.

[Edits for clarity. Latex edits - Calvin]

Common mistakes

  1. The pattern is not immediately periodic.

  2. Not getting both cases when taking modulo 25.

Matt notes that n n ! 1 ! + n ! 2 ! + + n ! n ! n \heartsuit \equiv \frac {n!}{1!} + \frac {n!}{2!} + \ldots + \frac {n!} {n!} . However, there isn't an easier way to deal with this summation. This problem would arguably be harder if this definition of n n \heartsuit was given instead.

Calvin Lin Staff - 7 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...