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

Home > Just Math
Going Maximum With Arithmetic (Posted on 2008-09-27) Difficulty: 3 of 5
Determine the maximum value of a (base ten) positive integer N (with non leading zeroes) such that each of the digits of N, with the exception of the first digit and the last digit, is less than the arithmetic mean of the two neighboring digits.

Note: Try to solve this problem analytically, although computer program/ spreadsheet solutions are welcome.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 5

DECLARE SUB addOn ()
DEFDBL A-Z
CLEAR , , 25000
DIM SHARED s$, maxV
FOR n = 10 TO 99
  s$ = LTRIM$(STR$(n))
  addOn
NEXT
PRINT maxV

SUB addOn
  p2 = VAL(MID$(s$, LEN(s$) - 1, 1))
  p1 = VAL(MID$(s$, LEN(s$), 1))
  i = 2 * p1 - p2 + 1
  DO WHILE i <= 9 AND i > -1
    s$ = s$ + LTRIM$(STR$(i))
    IF LEN(s$) > 10 THEN PRINT s$: STOP
    IF VAL(s$) > maxV THEN maxV = VAL(s$): PRINT maxV
    addOn
    s$ = LEFT$(s$, LEN(s$) - 1)
    i = i + 1
  LOOP
END SUB

finds

96433469


  Posted by Charlie on 2008-09-27 16:40:32
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 (6)
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