Download Todo list: 1. Mastermind With a code of only 4 long, it is

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Large numbers wikipedia , lookup

Addition wikipedia , lookup

Location arithmetic wikipedia , lookup

Arithmetic wikipedia , lookup

Elementary arithmetic wikipedia , lookup

Elementary mathematics wikipedia , lookup

Positional notation wikipedia , lookup

Approximations of π wikipedia , lookup

Transcript
Todo list:
1. Mastermind With a code of only 4 long, it is possible to guess the correct answer in 5
guesses or less. See. “Computer as Master Mind” by Donald Knuth in J. Rec. Math vol
9(1) 1976-7. Might be able to do it by maintaining an array of possible guesses and
prune it ourselves without his complex logic, but I’m not sure... (Quite complex and
may be a linked list exercise as well. Best done as a major project methinks.)
2. Triangle numbers: nth number = n(n+1)/2 x n = e(n ln x)
3. Digits of a Number
a. find sum of digits
b. determine the number of digits in a number
c. find the digital root of a number (repeatedly find the sum of the digits until you
get a number 0 to 9. Eg: 285: 2+8+5=15: 1+5=6)
d. print the digits in reverse order e. find the product of the digits of a number
e. find the digital product of a number (product of all non-zero digits of the
number.)
f.
find the persistence of a number. It is the number if times you can multiple the
digits iteratively) before you get a single digit number. Eg the persistence of
467 is 4 because 4*6*7=168 1*6*8 = 48 4*8 = 32 3*2 = 6. 4 steps. The persistence
of 5 is 0.
g. given a number ending with a 6, called A. Let B be A with the 6 moved to the
front. Eg A = 4576, then B = 6457. Find all the numbers A (or the first number A),
such that B = 4*A.
4. Long division Calculate x/y with only integers to a given number of decimal places or
when it terminates: q = x div y print q, “.” r = x mod y while r not= 0 d = r * 10 q = d div
y print q r = d mod y
5. Calculate pi using random numbers (Monte Carlo Algorithm) Generate a series of n
random numbers, x and y, between 0 and 1. For each pair (x,y), calculate the
distance from (0,0). If distance < 1, add 1 to a counter. Then pi . (counter/n)*4 14.
6. Hailstone numbers For a given n, iterate using the following rule: if n is even n = n/2,
else n = 3n + 1 Stop after the sequence 4, 2, 1 occurs. Will all n lead to this sequence?
Calculate the length of the sequence for a g
7. Poison penny (a very simple version of Nim) x pennies are laid out (x > 3). Two players
alternate taking 1 or 2 pennies. Whoever takes the last penny loses. (There can be
two players or one player versus the computer.)
8. Simple heads/tails guessing game. Ask the user to guess what the result of the next flip
of a coin is. Keep score. Another version is to play even or odd (ie. 2 heads/2 tails or 1
head and 1 tail), the user could flip a coin and so could the computer and either the
user or computer could guess the outcome. 33.
9. Paper/Rock/Scissors game Computer and user choose one of the three and
compare: paper covers rock rock breaks scissors scissors cuts paper
10. Geometric Formulas:
a. Rectangle:
i. area = hw
ii. perimeter = 2h + 2w
b. Parallelogram:
i. area= bh
ii. perimeter = 2h + 2w
c. Triangle:
i. area = ½bh
ii. Hero’s formula: area = sqrt(s(s-a)(s-b)(s-c)) s=½(a+b+c)
iii. perimeter = a + b + c
d. Trapezoid:
i. area = ½h(a+b)
e. Regular polygon:
i. area = ¼nb2 cos(PI/n)/sin(PI/n)
ii. perimeter = nb
f. Circle:
i. area = PIr 2
ii. circumference = 2PIr
iii. arc length = rt (in radians)
g. Box:
i. Volume = lwh
ii. Surface area = 2(lw + lh + hw)
h. Sphere:
i. Volume = 4/3PIr 3
ii. Surface Area = 4PIr 2
i. Cylinder:
i. Volume = PIr2 h
ii. Surface Area = 2PIrh
j. Cone:
k. Volume = aPIr 2h
i. Surface Area = PIrl
ii. l=sqrt(r2+h2 )
l.