# Thread: Looking for help on a sequence question - interesting problem

1. ## Looking for help on a sequence question - interesting problem

Hi Everyone,

I hope this is the right place for a sequence question but I'm stuck. I can solve it programatically but not mathematically and think I'm missing something.

A series is formed with an original value of 2 and each following term in the sequence given by the previous term + the highest prime factor of the previous term so...
an+1= an + pn. The first term a1 is 2.

The series is pretty easy to construct and the following terms are the first bunch 2,4,6,9,12,15,20,25,30,35,42,49,56,63,70,77,88,99, 110,121,132,143...

The question is: What is the largest value of n such that an is a four digit number. As I said I can loop through and brute force the thing using a computer but there's got to be a pattern I'm missing.

Over to all you clever math people.

Cheers

2. ## Re: Looking for help on a sequence question - interesting problem

It's not hard to show that the value of the largest 4-digit number in this series is 99 x 101 = 9999. But as for the value of n, hmmm... I need to think about it.

EDIT - OK, I thought about it, and I believe the value of n is 99+101-2 = 198.

The first step is to find the value the prime to use - it's either the largest prime whose square <= 10000, or the next higher prime after that. In this case the square root of 10000 = 100, so it's either 97 or 101. Since 97x101 = 9797, and we can continue to add 101's to it and still stay under 10000, the prime to use is 101. Next: 10000/101 = 99.0099, so the second factor is 99.

3. ## Re: Looking for help on a sequence question - interesting problem

I knew I was thinking about it badly I just couldn't see how to approach it.

Thanks heaps