All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Sequencing problems (Posted on 2004-10-01) Difficulty: 2 of 5
Consider a sequence of integers in arithmetical progression: A, A+B, A+2B, A+3B, ... A+NB.

Systematically pick any two adjacent numbers, and randomly replace them by their sum or difference. Keep at this until only one number remains. Is this number odd or even? What's the largest value this number can attain?

  Submitted by Federico Kereki    
Rating: 3.1667 (6 votes)
Solution: (Hide)
First, we can always assume B>0; if not, just reverse the sequence. However, A *could* be negative... and everybody missed that!

IF A>0, then all numbers are positive, and the greatest sum is S= A(N+1) + BN(N+1)/2. In any case, since x+y and x-y have the same parity, the parity of the last result will be the same as the parity of S.

HOWEVER!! If A<0, there are NEGATIVE numbers in the mix, you can achieve a larger S. For example, if A=-3, B=2, N=3, the numbers are -3, -1, 1 and 3. The first formula gives S=0, while you can do better: first subtract -3 from -1 (getting 2), and then sum all results, for a total of 6.

The idea is: if A, A+B, ..., A+KB are all negative, you can get a higher result by first subtracting A+KB from A+(K +1)B (getting B), then subtracting all the other negative terms from B, and then adding all positive terms. For example: if the sequence was -14, -11, -8, -5, -2, 1, 4, 7, 10, we would go: 1-(-2)=3; 3-(-5)=8; 8-(-8)=16; 16-(-11)=27; 27-(-14)=41; 41+4=45; 45+7=52; 52+10=62. The case with negatives needs more analysis!

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Law Assignment Helpandrew martin2023-09-14 03:56:26
Puzzle AnswerK Sengupta2023-09-13 21:40:37
re: Answerkeisha2004-10-01 14:05:45
re(2): solutionkeisha2004-10-01 14:03:04
No Subjectkeisha2004-10-01 14:01:20
re(2): solutionCharlie2004-10-01 12:23:20
Questionre: solutionnikki2004-10-01 11:45:22
Some ThoughtsLargest Value solution (partial spoilers)nikki2004-10-01 11:37:33
SolutionAnswerOld Original Oskar!2004-10-01 11:17:41
SolutionsolutionCharlie2004-10-01 09:22:17
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (23)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information