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

 Going Maximum With Arithmetic (Posted on 2008-09-27)
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 No Rating

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

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

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
s\$ = LEFT\$(s\$, LEN(s\$) - 1)
i = i + 1
LOOP
END SUB

finds

96433469

 Posted by Charlie on 2008-09-27 16:40:32

 Search: Search body:
Forums (0)
Random Problem
Site Statistics
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox: