Each of P, Q, R, S and (P+S), with P < Q < R < S, is a non leading zero 10digit base ten positive integer containing each of the digits from 0 to 9 exactly once. It is known that R is the arithmetic mean of P and S, and Q is the geometric mean of P and S.
Determine the minimum value of P and the maximum value of S.
I've found 27 possible quintuplets for {P, Q, R, S, P+S}.
The one with the smallest P value is:
{1076539482, 2153078964, 2691348705, 4306157928, 5382697410}.
The one with the biggest S value is:
{1975308642, 3950617284, 4938271605, 7901234568, 9876543210}.
The programming uses the following facts to elimate numbers from the 10! pandigitals generated.
Looping through all possible pandigitals for R (NB R<5000000000), keep only those that give a pandigital when doubled (since P+S=2R).
Let P = R  A and S = R + A so that Q^2 = PS becomes R^2 = Q^2 + A^2.
Now, for each R value, solve this equation for integer Q and A values (Maple has a proc for this but otherwise some extra coding is needed!!).
Q, R and S can now be checked for pandigitality(?).
Main Maple coding below (pancheck proc not included):
A := permute({0, 1, 2, 3, 4, 5, 6, 7, 8, 9})
for R in A while R[1] < 5 do
if R[1] > 0 then r := sum(R[i]*10^(10i), i = 1 .. 10)
t := 2*r
if pancheck(t) = 1 then
X := sum2sqr(r^2)
for x in X do
if x[1] > 0 then
q := x[2]
a := x[1]
if pancheck(q) = 1 then
p := ra
if pancheck(p) = 1 then
s := r+a
if pancheck(s) = 1 then
print(p, q, r, s, t)
end if:end if:end if:end if
end do
end if:end if
end do
Edited on July 24, 2009, 5:51 pm

Posted by Harry
on 20090724 17:47:48 