0% found this document useful (0 votes)
38 views

Computing - Latex

This document contains a report on Pascal's triangle and observations made about its properties. Key points include: 1) Diagonals exhibit distinct patterns - the first diagonal contains all 1s, the third contains triangular numbers, and sums of consecutive numbers in the third diagonal are square numbers. 2) Horizontal rows also show properties - rows 2, 3, and 7 contain only odd numbers, and the sum of each row is equal to 2 to the power of the row number. 3) Pseudocode is provided for algorithms to find the maximum value, average, median, and most frequent value in an array.

Uploaded by

Michael Gboneh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Computing - Latex

This document contains a report on Pascal's triangle and observations made about its properties. Key points include: 1) Diagonals exhibit distinct patterns - the first diagonal contains all 1s, the third contains triangular numbers, and sums of consecutive numbers in the third diagonal are square numbers. 2) Horizontal rows also show properties - rows 2, 3, and 7 contain only odd numbers, and the sum of each row is equal to 2 to the power of the row number. 3) Pseudocode is provided for algorithms to find the maximum value, average, median, and most frequent value in an array.

Uploaded by

Michael Gboneh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Computing and Latex Assignment5

Michael Gboneh ([email protected])

October 21, 2015

Circles and Rectangles

This work is a report on the class activity relative to Pascal triangle and my personal observations.

k = 0: 1
k = 1: 1 1
k = 2: 1 2 1
k = 3: 1 3 3 1
k = 4: 1 4 6 4 1
k = 5: 1 5 10 10 5 1
k = 6: 1 6 15 20 15 6 1
k = 7: 1 7 21 35 35 21 7 1
k = 8: 1 8 28 56 70 56 28 8 1
k = 9: 1 9 36 84 126 126 84 36 9 1
k = 10: 1 10 45 120 210 252 210 120 45 10 1

OBSERVATIONS:

i Diagonal Property:

a) the first diagonal from left and right contains all 1

b) the second diagonal from left and from right are set of natural numbers.

1
c) The third diagonal from left and from right contains 1,3,6,10,15,21,...these are triangular numbers. Tri-
angular numbers dot representation indicates a pattern that forms a triangle.for each time a row is
added, the amount of dot increase.

d) the sum of two consecutive numbers in the third diagonal from left and from right is a square number.
consider the third diagonal from left that contains the elements; 1,3,6,10,15,21,28,36,45 for this triangle
written up to row ten, It can clearly be shown below that consecutive sum is a square number
1+3=4
3+6=9
6 + 10 = 6
we can see that they are all square numbers,if we continued with the addition, our sum will all be square
numbers.

ii Horizontal Property:

a) the output of row 2,3,and row 7 are all odd numbers

b) The sum of the elements in each row is 2n where n the number of row example:
row 0 : 1 = 20
row one : 1 + 1 = 2 = 21
row two : 1 + 2 + 1 = 4 = 22
row three : 1 + 3 + 3 + 1= 8 = 23
we can see that powers of two correspond to the row number.

lets prove this observation:

k  
X n
(a + b)k = ax bk−x
k
x=0

let 2 = 1 + 1, we replace a and b by the two 1s

k  
k
X n
(1 + 1) = 1x 1k−x
k
x=0

given that x and k are real numbers, then using one as their base, we obtained 1, therefore we have:

k  
k
X n
(2) =
k
x=0

we can see that coefficient of the pascal triangle which is the combination of the given row and the
position of the element sum to a power of 2.

c) considering a given row, the corresponding element are result of 11n , where n is the row number
for instance : row 3 : 113 = 1331 = 1 3 3 1, the elements of row 3.

2
d) The sum of element in the odd position(Boxed) is equal to the sum of elements in the even posi-
tion(circle)
1 + 6 + 1 (even position from 0) = 4 + 4 (odd position) = 8

1 1

1 2 1

1 3 3 1

1
4 6
4 1

n:N
n:Z
a[0, i] is an array of Z
if a[i, j] ∈ a[0, n) then, M ax : a[i] ≥ a[j], ∀i,j ∈ a[0, n]

The specification of Average


n:N
n:Z
n−1
X
s: a[i]
i=0
n−1
X
a[i]
i=0
The average: n

Specification for median


n:N
n:Z
a=array[0, n)) of Z
M = Median
Maximum: n{x ∈ a|x ≤ m} = n{x ∈ a|x ≥ m}

Specification for frequency(most appearing number)


n:N
n:Z
Frequency = {a ∈ [0, n) |a [i] = x}

Question 2. Design space


i. The pseudo for maximum
procedure largest element(s, n)
largest:= s{1
rbrace
for p:= 2 to n d 
if s p} ≥ largest then
largest:= s[p]

3
return(largest)
end largest element
ii. The pseudo for average
a = array of N
n = number of elements sum = 0
sum = sum x[i]
i=i+1
average = sum
n
end
iii. The pseudo median
a[i] = elements in the array are sorted
if a[i] is odd,
median = text a n+1
 
2
else:
a[ n ]+a[ n+2 ]
median = 2 2 2

iv. The pseudo for frequency


elements in array must be 0 (nlogn) sorted in the case of merge
declare count = 1
max count = 1
max value = array[0]
iterating the array and indexing
computing the elements with the elements computed before
the counts are updated if they are equal
else: reset back counts max value
return max value

You might also like