The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

Another math challenge...
Message #1 Posted by Olivier TREGER on 15 Nov 2006, 5:20 a.m.

A population of insects grows at a tremendous rate: on January 1st 2004, there were 2004 insects. On Jan. 2nd, the number is 4009 (twice the previous amount plus 1). Each day of January, the population is multiplied by the day of month plus one.

In February, same thing but the growth is 2 instead of 1 (February: second month) so that on Feb. 2nd there are twice as many insects than on Feb. 1st, plus 2 and so on until Feb. 29th. In March, same principle but you add 3, in April add 4, etc... In December, add 12.

These insects use to fly in patrols of 13. When the number is not a multiple of 13, they manage to leave as few isolated ones as possible.

How many insects are left alone at the end of Dec. 31st 2004?

(also posted on nntp://alt.math.recreational)

      
Re: Another math challenge...
Message #2 Posted by Valentin Albillo on 15 Nov 2006, 7:06 a.m.,
in response to message #1 by Olivier TREGER

If I understand the problem correctly, as soon as you reach December 26th, all the zillions and zillions of insects, say N, get multiplied by 26, which happens to be a multiple of 13, and then 12 is added, as December is the 12th month, so you then have:

    new N = N * 26 + 12

which, obviously, leaves a reminder of 12 modulo 13. Afterwards there are just five additional days (27, ..., 31), and computing the reminders modulo 13, in the HP-71B right from the keyboard, you get:

   N=12 @ FOR D=27 TO 31 @ N=MOD(N*D+12,13) @ NEXT D @ N [ENTER]

12

so there will be just 12 insects in the lonesome group.

Even if you wouldn't come up with the December,26th shortcut, the following 3-line HP-71B program solves it trivially:

    1 DESTROY ALL @ OPTION BASE 1 @ DIM L(12) @ READ L @ N=2004
    2 DATA 31,29,31,30,31,30,31,31,30,31,30,31
    3 FOR M=1 TO 12 @ FOR D=1 TO L(M) @ N=MOD(N*D+M,13) @ NEXT D @ NEXT M @ PRINT N

>RUN 12

Best regards from V.

Edited: 15 Nov 2006, 7:21 a.m.

            
Re: Another math challenge...
Message #3 Posted by Olivier TREGER on 15 Nov 2006, 7:48 a.m.,
in response to message #2 by Valentin Albillo

Amazing...

The worst in this story is that since I didn't notice Dec 26th was a multiple of 13, I had to run a dumb routine in Mathematica... and found 12.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall