Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.1K Views
|
7 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to find if a list matches the content of another list

How can I check if a list, for example ,{{0,0},{0,0}},{7,3}} matches another list that contains {{0,0},{0,0}},{7,3}} as in the program lines below. How can I see if the list ( P6= List [p2,gg5] matches q55= List[q5]? I have tried freeQ , memberQ, find, count, substeQ but none of them seem to work...but if I copy the list {{0,0},{0,0}},{7,3}} and use with ctrl+f over the results of the program I get it right...

sq=Table[j,{j,100000}]
sq11=Table[j,{j,1000,2000}]
x=Select[sq,OddQ,(900)]
n1=Select[sq,CompositeQ,(400)]
n=Select[sq,PrimeQ,(200)]
z=(n-1)^2*(n+1)^3
g=Mod[z,3]
g2=Mod[z,5]
g3=Mod[z,7]
g4=Mod[z,11]
Select[n,PrimeQ,(200)]
Length[%]
z1=(n-1)^2*(n+5)^3
g1=Mod[z1,3]
g5=Mod[z1,11]
q=Riffle[g2,g3]
q1=Partition[q,2]
p=Riffle[g,g1]
q2=Partition[p,2]
r=Riffle[q1,q2]
h=Partition[r,2]
q3=Riffle[g4,g5]
q4=Partition[q3,2]
q5=Riffle[h,q4]
q55=List[q5]
q6=Partition[q5,2]
n=5210644015679228794060694325390955853335898483908056458352183851018372555735221
z=(n-1)^2*(n+1)^3
g=Mod[z,3]
g1=Mod[z,5]
g2=Mod[z,7]
g3=Mod[z,11]
Select[n,PrimeQ,(200)]
Length[%]
z1=(n-1)^2*(n+5)^3
g4=Mod[z1,3]
g5=Mod[z1,11]
gg1=List[g,g4]
gg=List[g1,g2]
gg2=List[g1,g2]
gg3=List[g3,g5]
gg4=List[g,g4]
gg5=List[g3,g5]
p=List[gg1,gg2]
p1=Partition[p,2]
p2=List[gg,gg1]
p3=Partition [p2,2]
p4=List[gg3]
p6=List [p2,gg5]
7 Replies

Hi Dr. Namjojshi so long not see you, I had not tried that Position... but thank you now it is working at content... the formula ( n-1)^2(n+1)^3 with mod x 3,5,7,11, along with the (n-1)^2(n+5) mod 3 and 11 allows me to differentiate prime from odd composites... because it generates a pattern of modules for both non primes and primes in a consecutive manner ad infinitum...but the pairs of modules 2 by two gives a list of numbers that either appear when the number is prime and not when it is not prime with high yield... I have checked for the 20 highest prime numbers listed on the Wikipedia and they all have a sequence that matches the ones listed in first lines of the program where it sets the patterns for the first 200 numbers ( that can be increases ) in 20 out of 400 it gives an intersection of sequences of pairs... I've published the results as primality test ( simple ) in Portuguese at figshare so glad to hear from you...

Posted 4 years ago

That is different from the original question you asked which involved p6 and q55.

How can i see if the list ( P6= List [p2,gg5] matches q55= List[q5]?

For p6 and q6 it is easy to see if the former occurs in the latter

Position[q6, p6]
(* {{47}} *)
POSTED BY: Rohit Namjoshi

Hi Hans i got it done with the following command:

Cases[q6, {___, Sequence @@ p6, ___}] // RepeatedTiming

I've tried all that is at this site and nothing seems to work...it is unfortunate because if I do it manually I can get with 98% certainty if a prime numbers is a prime number just by checking the match https://stackoverflow.com/questions/6201997/finding-sublist-in-lists-with-map-select-in-mathematica...

It still gives me false !!! but if i use ctrl +f and copy the result to check if all members of the list is contained it gives me true...

I will try that,thank you so much Hans!!!

What do you mean by "match"? Do you want to know whether the members of list1 are all contained in list2?

If yes I suggest

And@@(MemberQ[ list2, #]&/@list1)
POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard