Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[lisp/scheme]I am a begginer for scheme. there are three begging level of exercises. 1. Calculate the sum of the multiple 5 and 3 below 1000.

[lisp/scheme]I am a begginer for scheme. there are three begging level of exercises.

1. Calculate the sum of the multiple 5 and 3 below 1000. Code framework provided

Result: 233168

(define (sumOfall n)

0 ;write your code here, could add other helper function.

)

(display (sumOfall 1000))

2. The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 385 = 2640. Find the difference between the sum (the first 100 numbers). Code framework provided

Result: 333300

(define (difference n)

0 ; write your code, could add other helper function.

)

(display (difference 100))

3. Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

Result: 4613732

(define (evenFib n)

0 ; write your code, could add other helper function.

)

(display (evenFib 4000000))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions