Group Abstract Group Abstract

Message Boards Message Boards

0
|
51 Views
|
2 Replies
|
1 Total Like
View groups...
Share
Share this post:

Looping equations solving doesn't produce any output?

Posted 1 day ago

Tried to do the following but am not getting any output. Seems like valid code to me, but can't see what I'm doing wrong - any suggestions???

p = Table[PerfectNumber[n], {n, 10}];
For[i = 2, i < 11, i++, Solve[m^2*(2 m^2 - 1) - p[[i]] == 0, m]]

If I do a series of Solve[] with explicit values I get the expected output, so am a bit puzzled as to what I'm doing wrong. For example:

Solve[m^2*(2 m^2 - 1) - 28 == 0, m]
Solve[m^2*(2 m^2 - 1) - 496 == 0, m]
Solve[m^2*(2 m^2 - 1) - 8128 == 0, m] 

Gives the following:

{{m -> -2}, {m -> 2}, {m -> -I Sqrt[7/2]}, {m -> I Sqrt[7/2]}}

{{m -> -4}, {m -> 4}, {m -> -I Sqrt[31/2]}, {m -> I Sqrt[31/2]}}

{{m -> -8}, {m -> 8}, {m -> -I Sqrt[127/2]}, {m -> I Sqrt[127/2]}}

DId this with Mathematica version 14.2 on a Mac running macOS 26.1 if it matters. Again, thanks for any suggestions...

-bob

POSTED BY: Bob Freeman
2 Replies

You forgot Print:

For[i = 2, i < 11, i++,
 Print@Solve[m^2*(2 m^2 - 1) - PerfectNumber[i] == 0, m]]

More in line with WL style:

Table[Solve[m^2*(2 m^2 - 1) - PerfectNumber[i] == 0, m],
 {i, 2, 10}]
POSTED BY: Gianluca Gorni

Thanks a lot!!!

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