Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find 1 4 10 22
#3
Not Solved
Hi Vasu,

If i have correctly understood the sequence, it is in the form of n=n*2+2, n starting from 1. The following code will yield this sequence

Code:
Dim arr(10) //Declare an array which will contain the sequence numbers
totNum=4 // Total number in the sequence (here 4 since seq is 1 4 10 22)
arr(0) = 1 //Assign the first place with value 1

For counter=1 To totNum
    arr(counter) = arr(counter-1)*2+2
Next

The array should contain the sequence.
Reply


Messages In This Thread
Find 1 4 10 22 - by vasu - 12-08-2011, 12:35 PM
RE: Find 1 4 10 22 - by ravi.gajul - 12-08-2011, 10:00 PM
RE: Find 1 4 10 22 - by PrabhatN - 12-14-2011, 11:22 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)