Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to make a program which gives me what is the greater natural number "n" less than an arbitrary given natural number "k" which satisfy: for each prime divisor "p" of n, p^2-1 divides n.

I have solved the problem theoretically and now I need to implement the algorithm. In order to do that I need to calculate the prime factorization of a number "q", for each prime factor p of q calculate p^2-1 and check if p^2-1 divides n. If the conditions holds, then I want to print the number q and exit the program. Else, continue with the program and do the same for q-1.

I have read the documentation and I can calculate the prime factorization of q but then I don't know how to get the elements of the list that I need. I explain it with an example:


{{2, 2}, {3, 2}, {5, 3}, {541, 1}}

And now I don't know how to get 2, 3, 5, 541

Thanks and excuse me for my poor English I hope you understand what I am asking for.

share|improve this question

closed as off-topic by Mr.Wizard Jul 23 at 12:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Mr.Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

read aboutfunction Part –  molekyla777 Jul 23 at 11:37
See also First. –  Mr.Wizard Jul 23 at 12:27

1 Answer 1

FactorInteger[2434500][[All, 1]]
(* {2, 3, 5, 541} *)

[[All, 1]] should be read as take all rows, first column

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.