Confused on what a challenge is asking?

User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

it means that they would be adding the numbers 1 to 2118 together but whenever the number is a perfect square it gets added twice so here would be the first few steps:

Code: Select all

 n   1 2 3 4  5  6  7  8  9  10  ...
squ  y n n y  n  n  n  n  y  n   ...
sum  2 3 6 14 19 25 32 40 58 68  ...
where squ is y for square numbers and n if they aren't. 1,4 & 9 are added twice (total += 2*n) because they are 1^2, 2^2 & 3^2 respectively
User avatar
bodjo
Posts: 37
Joined: Sat Feb 26, 2011 9:27 am
Location: tunisia

rabbits everywhere

Post by bodjo »

it is embarrasing to be here again :oops:
i think i should work more on my english skills but till that time i will gladely accept any explanation for"the sum of 10th through 17th(rxclusive)
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

for example: the sum of the 1st through 5th (exclusive) natural numbers is 2+3+4=9 as the first five natural numbers are 1,2,3,4,5. Exclusive means don't include the end points i.e. start < n < end instead of start <= n <= end which would be inclusive
tompko
Posts: 11
Joined: Fri Feb 25, 2011 10:32 am
Location: London, UK

Post by tompko »

It means the sum of the items starting at the 10th and ending at the 17th, including the 10th and 17th items.
So if you have the following sequence:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
Then the sum of the 10th through 17th (inclusive) would be 108.
Post Reply