Say I have two lists:

list1 = {a, b, c, d}  
list2 = {b, b, d, d}

And I want to get the output

{False, True, False, True}

(so testing when elements of list1 are equal to elements of list2)

How would I do this? I've searched for quite a while, but couldn't find any way to do this.

Side info; this is for Project Euler question 4. I know how I want to solve it, it's just figuring out how to put it into *Mathematica* which is difficult to me.

SOLVED Using: MapThread[Equal,{list1,list2}]

  • $\begingroup$ If a,b,c,d are numbers, Thread[list1 == list2]. $\endgroup$ Jan 10, 2019 at 13:30
  • $\begingroup$ @ΑλέξανδροςΖεγγ This just gives me 'True' or 'False', not {false,true,false,true} , which is what I'm trying to get $\endgroup$ Jan 10, 2019 at 13:33
  • 2
    $\begingroup$ Duplicate of 26858 $\endgroup$
    – void life
    Jan 10, 2019 at 13:34
  • $\begingroup$ @voidlife Thank you! I had read that thread a little too quick, only seeing the same 'Thread' option (not reading the 'MapThread' one.) Thanks again! $\endgroup$ Jan 10, 2019 at 13:39


Browse other questions tagged or ask your own question.