SPUG: FW: Help..Any Math GENIUS out there?
Dan Ebert
mathin at mathin.com
Thu Jul 25 16:20:37 CDT 2002
On Thu, 2002-07-25 at 11:51, Yitzchak Scott-Thoennes wrote:
> In article <67AC2DB52118D411A8F300508B957F120A1F2C0B at WA-MSG02>,
> "Orr, Chuck (NOC)" <chuck.orr at attws.com> wrote:
> >> I am hoping to use Perl to solve an equation like the below:
> >>
> >> A + (36*B) + (360*C) + (3600*D) + (129600*E) = 2,307,012
> >>
> >> I know that each of the variables A - E is a whole number in the range
> >> 1-36.
> >>
> >> Could I load those numbers (1 -36) in an array and substitute each number
> >> for each variable until this is solved?
>
> You could (though an array is unneccessary). A slightly better
> approach would be to compute A for all different combos of B,C,D,E and
> see if it is valid (integer in 1-36).
>
> In your example, there appears to be a relationship between the coefficients
> (1 (implied), 36, 360, 3600, 129600). If that is true in general, you can
> solve it without going through all the combinations. For instance, you
> can easily find E = 17 and A = 24 in the above, leaving you with:
>
> B + 10*C + 100*D = 2883
>
OK, I see how you got E=17 ... less than that and the total cannot =
2,307,012 even if A,B,C, and D all = 36. if E > 17 the total will be
too big even ig A,B,C, and D all = 1.
How did you arrive at a=24?
Thanks.
> which has several solutions (by inspection, about 14).
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
> Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
> For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
> Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
>
--
Dan Ebert <mathin at mathin.com>
----------------------------------------------------------
"If you're right 90% of the time, why quibble about the remaining 3%?"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list