I am working on this problem and I feel like I’ve come so close.

Write a module that takes as input a positive integer m, prints the first m positive odd numbers and returns the square root of the sum of the numbers it printed.

This is what I have so far:

kellyrocks[m_]:=Module[{index,sum},index=0;sum=0;

If[Or[m<= 0,IntegerQ[m]==False],Return["Please enter a positive integer"]]; While[index<=m,sum=sum+index;index=2*index+1]; Return[sqrt[sum]]] But when I try to run it I'm not getting what I should, ex: kellyrocks[22] sqrt[26] I'm very new to mathematica and I'm not sure what I'm missing. I also am not sure about printing each number. Thank you in advance! ================= Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Mar 11 at 3:45 ================= 1 Answer 1 ================= g[n_Integer?(Positive@# &)] := (Print@#; Sqrt@Tr@#) &@Range[1, 2 n - 1, 2] g[3] (* {1,3,5} 3 *) 1 The square root of 9 (1+3+5) is certainly not 35 – RunnyKine Mar 11 at 2:47 1 But, but, the square root of 9 is 3. It should be Sqrt@Tr@# – RunnyKine Mar 11 at 2:50 2 @RunnyKine Damn. You're too clever. Clearly an outlier 🙂 – Dr. belisarius Mar 11 at 2:51 1 The answer is always going to be an integer, in fact, its always going to be n, so the N is probably not required. – RunnyKine Mar 11 at 3:09 1 @Kelly Oh, well. I disagree. You came here seeking for help and you should pay with the same coin you got. – Dr. belisarius Mar 11 at 3:48