Skip to main content
Commonmark migration
Source Link

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

Edit

###Edit II can print the output by wrapping PowerMod in Print[]. How can I accomplish printing i and then the result from PowerMod? Here is what I tried, but it is incorrect since I don't know the syntax to use here:

For[i = 0, i < 15, i++, Print[i] Print[PowerMod[i, -1, 15]]]

This prints i and then the result of PowerMod below it. How can I get them on the same line?

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

###Edit I can print the output by wrapping PowerMod in Print[]. How can I accomplish printing i and then the result from PowerMod? Here is what I tried, but it is incorrect since I don't know the syntax to use here:

For[i = 0, i < 15, i++, Print[i] Print[PowerMod[i, -1, 15]]]

This prints i and then the result of PowerMod below it. How can I get them on the same line?

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

Edit

I can print the output by wrapping PowerMod in Print[]. How can I accomplish printing i and then the result from PowerMod? Here is what I tried, but it is incorrect since I don't know the syntax to use here:

For[i = 0, i < 15, i++, Print[i] Print[PowerMod[i, -1, 15]]]

This prints i and then the result of PowerMod below it. How can I get them on the same line?

added 102 characters in body
Source Link
connor
  • 153
  • 5

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

###Edit

  I can print the output by wrapping PowerMod in Print[]. How can I may also not be seeingaccomplish printing i and output at all right now becausethen the result from PowerMod? Here is what I tried, but it is showingincorrect since I don't know the following when evaluatedsyntax to use here:

PowerMod::ninv: 0 is not invertible modulo 15. >>
PowerMod::ninv: 3 is not invertible modulo 15. >>
PowerMod::ninv: 5 is not invertible modulo 15. >>

For[i = 0, i < 15, i++, Print[i] Print[PowerMod[i, -1, 15]]]

This prints i and then the result of PowerMod below it. How can I get them on the same line?

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

###Edit

  I may also not be seeing and output at all right now because it is showing the following when evaluated:

PowerMod::ninv: 0 is not invertible modulo 15. >>
PowerMod::ninv: 3 is not invertible modulo 15. >>
PowerMod::ninv: 5 is not invertible modulo 15. >>

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

###Edit I can print the output by wrapping PowerMod in Print[]. How can I accomplish printing i and then the result from PowerMod? Here is what I tried, but it is incorrect since I don't know the syntax to use here:

For[i = 0, i < 15, i++, Print[i] Print[PowerMod[i, -1, 15]]]

This prints i and then the result of PowerMod below it. How can I get them on the same line?

Routine clean-up
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

Mathematica loop Perform For-loop and show output if truewhich meets a certain criterion

I am new to MathematicaMathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesntdoesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

Edit* :###Edit

I may also not be seeing and output at all right now because it is showing the following when evaluated:

PowerMod::ninv: 0 is not invertible modulo 15. >>
PowerMod::ninv: 3 is not invertible modulo 15. >>
PowerMod::ninv: 5 is not invertible modulo 15. >>

Thanks for any help

PowerMod::ninv: 0 is not invertible modulo 15. >>
PowerMod::ninv: 3 is not invertible modulo 15. >>
PowerMod::ninv: 5 is not invertible modulo 15. >>

Mathematica loop and show output if true

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesnt output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

Edit* : I may also not be seeing and output at all right now because it is showing the following when evaluated:

PowerMod::ninv: 0 is not invertible modulo 15. >>
PowerMod::ninv: 3 is not invertible modulo 15. >>
PowerMod::ninv: 5 is not invertible modulo 15. >>

Thanks for any help

Perform For-loop and show output which meets a certain criterion

I am new to Mathematica and I have a For loop like so:

For[i = 0, i < 15, i++, PowerMod[i, -1, 15]]

Currently it doesn't output anything. The calculation I am performing is i^-1 mod n. I want t his loop to output the values of i ONLY where i = i^-1 mod n. How can i accomplish this?

###Edit

I may also not be seeing and output at all right now because it is showing the following when evaluated:

PowerMod::ninv: 0 is not invertible modulo 15. >>
PowerMod::ninv: 3 is not invertible modulo 15. >>
PowerMod::ninv: 5 is not invertible modulo 15. >>

added 306 characters in body
Source Link
connor
  • 153
  • 5
Loading
Source Link
connor
  • 153
  • 5
Loading