Sie sind auf Seite 1von 2

1.

Add all natural numbers below one thousand which are multiples of 3 and 5

2. Find the largest palindromic number made from the product two 3-digit numbers

3. Count the number of vowels in a string

4. Find the only pythogorean triplet (a,b,c) for which a+b+c=1000


The triplet (a,b,c) is called pythogorean if a^2+b^2=c^2 and a<b<c

5. See the following rules: n->n/2 if n is even; n->(3n+1) if n is odd.


Starting with a positive integer n, the above sequence terminates with 1.
For example starting with 13, the sequence is

13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1

Which number below one million, produces the longest sequence?

6. row 0: 1
row 1: 1,1
row 2: 1,2,1
row 3: 1,3,3,1
row 4: 1,4,6,4,1
row 5: 1,5,10,10,5,1
row 6: 1,6,15,20,15,6,1
....
....
.... so on

Observe the pattern in the above. Write a function which will compute the numbers in row n given n.

7. Write a function to compute the fibonacci sequence. Find the sum of all even fibonacci numbers under
4 million

8. How many Sundays fell on the first of the month during the twentieth century
Note: Twentieth century is 1 Jan 1901 to 31 Dec 2000. Remember to take care of leap years

9. How many letters would be needed to write all the numbers from 1 to 1000 in words

10. Indian currency has 1 rupee coins, 2 rupee coins, 5 rupee coins, 10 rupee notes,20 rupee notes, 50
rupee notes,
100 rupee notes, 500 rupee notes, and 1000 rupee notes. Write a function which takes a positive integer
as
input and prints out how many pieces of each denomination are contained in it.
For example: The input 2783 should give the following output

1000 rupee notes --- 2


500 rupee note --- 1
100 rupee notes --- 2
50 rupee note --- 1
20 rupee notes --- 2
10 rupee note --- 1
2 rupee coin --- 1
1 rupee coin --- 1

Das könnte Ihnen auch gefallen