0
$\begingroup$

This question already has an answer here:

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

$\endgroup$

marked as duplicate by Community Jan 10 at 13:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ If a,b,c,d are numbers, Thread[list1 == list2]. $\endgroup$ – Αλέξανδρος Ζεγγ Jan 10 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$ – joshua moelans Jan 10 at 13:33
  • 2
    $\begingroup$ Duplicate of 26858 $\endgroup$ – void life Jan 10 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$ – joshua moelans Jan 10 at 13:39

Browse other questions tagged or ask your own question.