# SPUG: FW: Help..Any Math GENIUS out there?

Duncan McGreggor oubiwann at myrealbox.com
Thu Jul 25 15:38:06 CDT 2002

```Man, it's been a really long time since linear algebra... but I think that since you don't have 5 equations (to go with your 5 vars), you can't solve it with a matrix...

It's not a quad, cubic, etc., so you can't solve it with those methods...

What about brute forcing it:

for (\$a=1;\$a<=36;\$a++) {
\$A=\$a;
for (\$b=1;\$b<=36;\$b++) {
\$B=36*\$b;
for (\$c=1;\$c<=36;\$c++) {
\$C=360*\$c;
for (\$d=1;\$d<=36;\$d++) {
\$D=3600*\$d;
for (\$e=1;\$e<=36;\$e++) {
\$E=129600*\$e;
if ( \$A + \$B + \$C + \$D + \$E == 2307012 ) {
print "found a solution:\n\t\$a, \$b, \$c, \$d, \$e\n";
}
}
}
}
}
}

I don't know if my math is right, but I got the following results:

found a solution:
24, 3, 8, 28, 17
found a solution:
24, 3, 18, 27, 17
found a solution:
24, 3, 28, 26, 17
found a solution:
24, 13, 7, 28, 17
found a solution:
24, 13, 17, 27, 17
found a solution:
24, 13, 27, 26, 17
found a solution:
24, 23, 6, 28, 17
found a solution:
24, 23, 16, 27, 17
found a solution:
24, 23, 26, 26, 17
found a solution:
24, 23, 36, 25, 17
found a solution:
24, 33, 5, 28, 17
found a solution:
24, 33, 15, 27, 17
found a solution:
24, 33, 25, 26, 17
found a solution:
24, 33, 35, 25, 17

Duncan

-----Original Message-----
From: "Orr, Chuck  (NOC)" <chuck.orr at attws.com>
To: "'spug-list at pm.org'" <spug-list at pm.org>
Date: Thu, 25 Jul 2002 10:50:52 -0700
Subject: SPUG: FW: Help..Any Math GENIUS out there?

> Hello,
>
> 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?
>
> Any ideas would be greatly appreciated.
>
>
> Thanks,
> Chuck Orr
> AT&T Wireless Services
> 425 288 2386
> chuck.orr at attws.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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

```