Skip to main content
deleted 3 characters in body
Source Link

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
    i := i + 1
    s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
    i := i + 1
    s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
    i := i + 1
    s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

added 8 characters in body
Source Link
CodesInChaos
  • 5.9k
  • 4
  • 23
  • 28

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
    i := i + 1
    s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
i := i + 1
s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
    i := i + 1
    s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

Remove salutation
Source Link
Martijn Pieters
  • 14.7k
  • 10
  • 60
  • 59

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
i := i + 1
s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

I hope there's someone who could help me.

Thanks in advance,

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
i := i + 1
s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

I hope there's someone who could help me.

Thanks in advance,

I'm studying for my exam of logic later this week and I have to prove that this while loop:

i := 0
s := 0
while i < n do
i := i + 1
s := s + (2*i -1)

calculates n^2. This question is made up of 2 subquestions. We have to prove that 0 ≤ i ≤ n ∧ s = i^2 is a loop invariant for this while loop. I managed to prove that, but in the second subquestion is that I have to prove that this loop calculates n^2, but I don't really know how to start. The course is a bit confusing about this part of the question.

Source Link
Loading