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

Home > Just Math
Going Maximum With Harmonic (Posted on 2013-12-28) 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 harmonic mean of the two neighboring digits.

*** For an extra challenge, solve this puzzle without the aid of a computer program.

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 2

DECLARE SUB build (n#)
DEFDBL A-Z
CLEAR , , 25000


CLS
DIM SHARED h(50), maxv, v

maxv = 1
FOR st = 1 TO 9
  h(1) = st: v = st
  build 2
NEXT

SUB build (n)
  FOR tr = 1 TO 9
    IF n = 2 THEN
      h(n) = tr: vsave = v: v = v * 10 + tr
      IF v > maxv THEN
        maxv = v
        FOR i = 1 TO n
          PRINT h(i);
        NEXT
        PRINT
      END IF
      build n + 1
      v = vsave
    ELSE
      IF h(n - 1) < 2 / (1 / h(n - 2) + 1 / tr) THEN
        h(n) = tr: vsave = v: v = v * 10 + tr
        IF v > maxv THEN
          maxv = v
          FOR i = 1 TO n
            PRINT h(i);
          NEXT
          PRINT "   "; v
        END IF
        build n + 1
        v = vsave
      END IF
    END IF
  NEXT
END SUB

finds as the highest:

976679


  Posted by Charlie on 2013-12-28 16:00:13
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