Tag Info

New answers tagged

1

Just another way: lst = {1, 4, 10, 14} f[u_] := u ->Reap[If[Mod[(u + 1) #, 15] == 0, Sow[#]] & /@ Range[0, 14]][[-1, 1]] f /@ lst yields: (*{1 -> {0}, 4 -> {0, 3, 6, 9, 12}, 11 -> {0, 5, 10}, 14 -> {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}}*) or perhaps: g[u_] := u -> Range[0, 14, 15/GCD[15, u + 1]] g/@lst


2

This answer is concerned about formatting the output is the style shown in the question. I start by generating the list of b values using the method given by Mr.Wizard. aVals = {1, 4, 11, 14}; bVals = Range[0, 14]; validate[a_] := {a, Pick[bVals, Mod[bVals (1 + a), 15], 0]} valid = validate /@ aVals {{1, {0}}, {4, {0, 3, 6, 9, 12}}, {11, {0, 5, 10}}, ...


6

I propose: a = {1, 4, 11, 14}; b = Range[0, 14]; {#, Pick[b, Mod[b (1 + #), 15], 0]} & /@ a { {1, {0}}, {4, {0, 3, 6, 9, 12}}, {11, {0, 5, 10}}, {14, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}} } Anything more is formatting, which I shall leave to you.


1

l = {1, 4, 11, 14}; ({#, b /. Solve[Mod[b (1 + #), 15] == 0 && 0 <= b <= 14, b, Integers]} & /@ l) // Grid


0

Here's one way: build a list that contains the indices you want (called zeros) and then parse the list to get the form you want the output in: zeros = Mod[Range[0, 14] (1 + #), 15] & /@ {1, 4, 11, 14}; Table[Transpose[Select[Position[zeros, 0], #[[1]] == i &]][[2]] - 1, {i, Length[zeros]}] {{0}, {0, 3, 6, 9, 12}, {0, 5, 10}, {0, 1, 2, 3, 4, 5, 6, ...



Top 50 recent answers are included