The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Brain smoker ...
12-12-2014, 02:20 PM (This post was last modified: 12-13-2014 10:37 AM by DrD.)
Post: #1
Brain smoker ...
This was my challenge of the day:

Find the sum of the absolute values of the products, of all the pairs of numbers, where one is drawn from each of two lists:

Example
a:={2,-3}
b:={4,-5}

This is the goal: (Absolute values of the above): 2*4 + 2*5 +3*4 +3*5 = 45

I tried a few things and came up with this: sum(mat2list(map(a,(a)->ABS(a*b))))

which seems to be my best effort (so far!) If you feel so inclined, can you find other (hp prime) ways, perhaps more efficient in some way?

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Brain smoker ... - DrD - 12-12-2014 02:20 PM
RE: Brain smoker ... - Didier Lachieze - 12-12-2014, 04:25 PM
RE: Brain smoker ... - Nigel (UK) - 12-12-2014, 09:18 PM
RE: Brain smoker ... - Han - 12-12-2014, 10:07 PM
RE: Brain smoker ... - Gilles - 12-12-2014, 11:10 PM
RE: Brain smoker ... - Han - 12-13-2014, 12:53 AM
RE: Brain smoker ... - Gilles - 12-13-2014, 08:58 AM
RE: Brain smoker ... - DrD - 12-13-2014, 10:37 AM



User(s) browsing this thread: 1 Guest(s)