Another University of Houston calculator contest



#7

If you're looking for something to do over Thanksgiving while trying to avoid the in-laws and Crazy Cousin Harry, here's another calculator contest from the university of Houston:
University of Houston 2008 calculator contest for TI 89/92

I'll post my answers and comments in reply.

Enjoy!
Dave


#8

Here are my answers, done on a 48gii. Corrections, comments and improvements are gratefully accepted.

1. Plugging in the numbers leads to [[4 -2 1] [9 3 1] [196 14 1]] * [a b c] = [6 3.5 29]. Since the calculator lets you "divide" matrices, I did this:
[6 3.5 29] [[4 -2 1] [9 3 1] [196 14 1] / OBJ-> DROP + + EVAL

Answer: 3.443181


2. 20931601446 FACTOR
Result is 347*227*37*19*7*3^3*2

3. 21456326 ENTER 3241157 GCD yields 1
So no common factors.

If the GCD were greater than 1, then applying FACTORS to it would yield the common prime factors.

4. Of course this depends on the current date, but the TIME menu makes quick work of it.

DATE 2.162097 DDAYS 24 * 3600 *

5. Graph the the function y=x+cos(30x)-1 from .9 to 2.1. There are 8 solutions that are clearly within the region and 2 (or is it 3?) that are near the boundaries.

Closer investigation with ROOT and ZOOM shows that the root near 1 is too small. Using ZOOM, BOX2 shows that there are two roots just slightly less than 2.

Answer is 10.


6. 37* (sum of digits) + 8 * (product of digits) > 45742.
The sum of the digits given is 24 and the product is 960, so if you have a digit x, then the formula become 37(24+2x+1) + 8(960x(x+1)) > 45742.

I programmed the formula and ran through the digits 0-8. Smallest result that's less than 45742 occurs with 2.

Answer: 2


7. The formula for each term is (-1^(x+1)) / x. So program it as

0. 1. 1000. FOR X -1 x 1 + ^ X / + NEXT


8. << DUP INV SWAP 2 / + >>

'P8' STO

1. ENTER P8 P8 P8 P8

Result is 1.4142135... So answer to problem is 3.

9. If I remember my math right, the sum is approximately ln(n-0.5), so n is about 148. Armed with this I wrote a program to compute the sum, flubbed it with an off-by-one error and tried again. I ended up with this:

%%HP: T(3)A(R)F(.);
\<< 0. 1. \-> S X
\<<
DO X INV 'S' STO+ 1. 'X' STO+
UNTIL S 5.5 >
END X 1. -
\>>
\>>

Plugging numbers in yielded 137 as the answer.


10. 11201 ENTER NEXTPRIME NEXTPRIME NEXTPRIME etc.


11. Solve 2x-sin(x)-10 = 0. Answer 4.5102


12. Starting with $5, each time she talks to someone, she adds $4, so the sums are 5, 9, 13, etc. Each value mod 4 = 1. So the first value that she'll have in the range is 2,134,565 and they continue to 2,134/585. Now when the problem says "strictly between" do they mean that the end points are not included? That determines whether the last one is included or not.


13. f(x) = cos(1/x)

g(x) = f(f(f(f(x))))

I graphed 10*g(x)+9 and found 4 roots in the range. From the graph window, From the graph window, Press FCN, move the cursor near a root and press ROOT. When it gets the value, press ENTER to copy the root the stack. Repeat for the other roots. Exit he graph window, press "+" 3 times and you have the sum of the roots. I got 0.3183757


14. Ratio of cicumference to area is 4/D.

To compute the sum of the ratios I wrote this program:

%%HP: T(3)A(R)F(.);
\<< { 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. } ADD INV \GSLIST 4. *
\>>

Plugging in values until I narrowed it down to the one closest to 1/100, I got a program input of 5992, which means the max circumference was 6007.


15. Enter the polynomial and press FACTOR. The hardest part of this one was avoiding typo's.


16. If everyone turned in their money then 43 + 81X + 22Y + 630 = 2887. Where X > 20 and Y < 5. Simplifying gives 81X + 22Y = 2214. There are no integer solutions to this.

The total money in the room is the money collected plus the money m still in their pockets, so 81X+22Y = 2214+m. Recast this as 2214-22Y = 81X-m. Modulo 81 gives (I think) (2214-22Y) mod 81 = 81-m.
I wrote this program to generate the m for each value of Y (1-5)>

%%HP: T(3)A(R)F(.);
\<< 1 5
FOR X 2214 X 22 * - 81 MOD 81 SWAP -
NEXT
\>>
Running it showed m=2 when Y=5.


17. Divide by 19 to get 7140766 factors of 19. Divide it by 31 to get 4376598 factors of 31. Now you've double counted the factors of 31*19 = 589. There are 230347 of those. So there are 11287017 unique factors of 19 and 31 between 1 and 135674561. 135674561-11287017 = 124387544.

But that isn't the right answer, because they want value of x between 1 and 135674561 EXCLUSIVE, so you have to remove 1 and 135674561. Therefore the answer is 124387542.


18. Here is a brute force program that works, but it's ugly. It tries every combination of adding and subtracting the numbers:


%%HP: T(3)A(R)F(.);
\<< -54 54
FOR X54 -74 74
FOR X74 -112 112
FOR X112 -131 131
FOR X131 -172 172
FOR X172 -191 191
FOR X191 -213 213
FOR X213 -261 261
FOR X261 -436 436
FOR X436
IF X54 X74 + X112 + X131 + X172 + X191 + X213 + X261 + X436 + 406 ==
THEN X54 X74 X112 X131 X172 X191 X213 X261 X436 9 \->LIST
END
872 STEP
522 STEP
426 STEP
382 STEP
344 STEP
262 STEP
224 STEP
148 STEP
108 STEP
\>>

There is one solution: 54-74-112+131-172+191+213-261+436


19. The general question of how many ways to form an amount from specific coins was the subject of a previous thread. Running my program, which took forever even on an emulator, gave an answer of 28050. There must be an easier way for to have been given on a test for high school kids.


20. Three stacks to the moon would stand 384402*3 km high, which is 1.153206E12 mm. At 0.11mm per dollar bill, that's 1.04836909E13 bills. The debt would have to grow by a factor of 1.13337199 to reach that value.

1.00016^n = 1.1333719. n = 782.55, so the smallest number of full days is 783.


#9

Quote:
19. The general question of how many ways to form an amount from specific coins was the subject of a previous thread. Running my program, which took forever even on an emulator, gave an answer of 28050. There must be an easier way for to have been given on a test for high school kids.


There is.

You could do it with 149 quarters.

Or 148 quarters. The missing quarter could be made up with 5 nickels, or 3, or 1 (and the difference in dimes).

Or 147 quarters. And the 2 missing quarters could be made up with 10 nickels, or 8, 6, 4, 2, or 0.

There is 1 way to do it with 149 quarters.

3 ways to do it with 148 quarters.

6 ways with 147.

8 with 146.

11 with 145.

13 with 144.

16 with 143.

And so on, down to 371 ways for 1 quarter, and 373 ways for 0.

Every other one adds 2 ways, while the alternate add 3 ways (which is due to the nickels being even or odd).

So you just add 1+3+6+8+11+13+16+...+371+373.

You could think of this as two separate series, each adding 5 each time.

1+6+11+16+...+371=75+5*(1+2+...+74) = 75 + 5 * (74^2+74)/2 = 13950

And

3+8+13+...+373=3*75+5*(74^2+74)/2==13950+2*75=14100

And the total =4*75+5*(74^2+74)=28050.


#10

Very nice!


I am ashamed to tell it took 2h26m49s for my pure brute force Pascal program to find the solution on the HP-200LX...
I couldn't help remembering these verses:

"Why to think, to imagine?
The machine will do it for us."
("Por que pensar, imaginar? A máquina o fará por nós." in the
original Portuguese)

#11

"Houston, we have too many problems here!". Fortunately all of them are solved :-)

A small suggestion to number 9:

A better approximation for the sum is ln(n)+0.5772 (where 0.5772 is the Euler-Mascheroni constant). So you can try e5.5-0.5772 ~ 137. Summation, instead of a program, might be an option:

'SIGMA(n=1,137,1/n)' EVAL --> 5.50084178581

Gerson.


#12

Thank you Gerson and Crawl for your excellent suggestions.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HHC 2013 programming contest winners Brian Walsh 52 2,818 09-26-2013, 11:39 PM
Last Post: David Hayden
  HHC / HP Museum Programming Contest for RPN and RPL machines Gene Wright 18 1,202 09-22-2013, 09:39 AM
Last Post: Miguel Toro
  HHC 2012 RPN Programming Contest - 10-Step Way-After-Nashville Solution Jeff O. 32 1,905 10-12-2012, 01:41 AM
Last Post: Paul Dale
  Mini-challenge: HHC2012 RPL programming contest with larger input David Hayden 14 906 10-05-2012, 10:36 PM
Last Post: David Hayden
  HHC 2012 RPN Programming Contest Gene Wright 73 2,388 09-28-2012, 12:43 PM
Last Post: x34
  HHC 2012 RPL Programming Contest Gene Wright 33 1,740 09-27-2012, 01:57 AM
Last Post: Werner
  HP Forum HHC Programming contest idea / possible rules Gene Wright 30 1,414 09-26-2011, 08:07 AM
Last Post: Gerson W. Barbosa
  HHC 2011 is 5 weeks away --- bring your 20b/30b to be flashed and the programming contest... Gene Wright 27 1,303 08-21-2011, 05:08 PM
Last Post: gene wright
  Capture the flag - HP-12C programming contest x34 10 653 02-13-2011, 06:59 PM
Last Post: Allen
  Design contest ;) Walter B 9 512 08-31-2010, 06:06 PM
Last Post: Walter B

Forum Jump: