Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.5K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Riffle[ ] give an error in Module[ ]

Can anyone tell me how to get a result according to the q6 list of pairs?

sq=Table[j,{j,100000}];
sq11=Table[j,{j,1000,2000}];
x=Select[sq,OddQ,(200)];
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];
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];
q6=Partition[q5,2]

ClearAll@f
f[n_,g2_,g3_g1 _,g_,g4_,g5_,q1_,p_,q_,q2_,r_,q3_,h_,q4_,q5_,q6_] := Module[{z,z1},
  z= (n-1)^2*(n+1)^3;
g=Mod[z,3];
g2=Mod[z,5];
g3=Mod[z,7];
g4=Mod[z,11];
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];
q6=Partition[q5,2]]
Table[If[MemberQ[q6, f[n]], {n, f[n]}, Nothing], {n, 1, 9961}]
Table[If[MemberQ[q6, f[n]], {n,(n-1)^2*(n+1)^3, f[n]}, Nothing], {n, 1, 9961}]
Table[If[MemberQ[q6, f[n]], {n,PrimeQ[(((n-1)^2*(n+1)^3)/7)+g3], f[n]}, Nothing], {n, 1, 9961}]
4 Replies

Your code has several problems. Please revise it and check the result of every step to debug it. Examples if the problems:

  • You define f[ ] with several argument however, you call it with only one argument. In your case you need to define it only with f[n_]:=.....
  • In the upper code part, n is a list of numbers. But at the button, you pass only one number to n when you call f[n] inside Table[ ], that is why g1 and g2 gets only one number and as a result Riffle gives errors.

Hope this helps.

POSTED BY: Ahmed Elbanna

Thank you, but that I had noticed before, I just got tired of trying to fix it...it does give me an empty set solution, but that IS not in agreement with another right result that I got with other lines...thank you so much...

Then I guess you should have mentioned the errors you are aware of to ease our members' task to help.
This part of your code works as intended (I removed the extra arguments)

ClearAll@f
f[n_] := Module[{z,z1},
  z= (n-1)^2*(n+1)^3;
g=Mod[z,3];
g2=Mod[z,5];
g3=Mod[z,7];
g4=Mod[z,11];
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];
q6=Partition[q5,2]]

Your problem lies in Table[ ]. It is not clear what you are trying to do in this part

Table[If[MemberQ[q6, f[n]], {n, f[n]}, Nothing], {n, 1, 9961}]
Table[If[MemberQ[q6, f[n]], {n,(n-1)^2*(n+1)^3, f[n]}, Nothing], {n, 1, 9961}]
Table[If[MemberQ[q6, f[n]], {n,PrimeQ[(((n-1)^2*(n+1)^3)/7)+g3], f[n]}, Nothing], {n, 1, 9961}]

Please explain clearly the purpose of this part so that our community can help you.

POSTED BY: Ahmed Elbanna
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard