Three 3-digit non leading zero positive base N integers
P,
Q
and
R, with
P >
Q >
R, are such that:
(i)
Q is the harmonic mean of
P and
R, and:
(ii)
P,
Q and
R can be derived from one another by
cyclic permutation of digits.
Determine all possible positive integer values of N ≤ 30 for which this is possible.
I can't come up with anything using the following code:
FOR n = 2 TO 30
FOR a = 1 TO n-1
FOR b = 0 TO n-1
FOR c = 0 TO n-1
abc = Base2Dec(a, b, c, n)
bca = Base2Dec(b, c, a, n)
cab = Base2Dec(c, a, b, n)
IF abc <> bca AND abc <> cab THEN
IF bca = HMean(abc, cab) THEN PRINT abc, bca, cab, n
IF cab = HMean(abc, bca) THEN PRINT abc, cab, bca, n
IF abc = HMean(bca, cab) THEN PRINT bca, abc, cab, n
END IF
NEXT c
NEXT b
NEXT a
NEXT n
END
FUNCTION Base2Dec (a, b, c, base)
Base2Dec = a*base^2 + b*base + c
END FUNCTION
FUNCTION HMean (x, y)
HMean = 2*x*y / (x + y)
END FUNCTION
The closest I can find is '102', '120', and '210' in base 4 (18, 24, and 36 respectively), which I'm pretty sure is not a cyclic permutation.
I also ran the above code for n = 31 to 50 and still came up with nothing.