Student Support Forum: 'programming help, finding factors of LCM' topicStudent Support Forum > General > "programming help, finding factors of LCM"

 Next Comment > Help | Reply To Topic
 Author Comment/Response JD 07/08/13 5:07pm Okay, so once again, I have read the documentation and the manual, I do exactly what it says to do, and mathematica either will not work or repeats what I just said. It's supposed to be world changing software, but I can't get it to calculate anything. Does it need gas? This is not homework, but it is critical to my research. And my future, so Sum [ " Thank You ", { i, 1, Infinity } ] for your help. So here's what I am doing. I'm working on finding the number of factors that a number will have. This number is an LCM of consecutive integers that are greater than 0. So the LCM of 1 through 6 is ( 1 x 2 x 3 x 2 x 5 x 1 ), which equals 60. The prime factors of 60 are 2,3,2,and 5. This is ( 2^2 x 3^1 x 5^1 ). If we examine the exponents or powers of the prime factors, there is a 2, a 1, and a 1. If I add 1 to each exponent, giving a 3, a 2, and a 2, and multiply those numbers together, it will yield the number of factors. There are ( 3 x 2 x 2 ) = 12 factors of 60. This count includes 1 and the number itself as factors : ( 1 , 60 ), ( 2 , 30 ), ( 3 , 20 ), ( 4 , 15 ), ( 5 , 12 ), ( 6 , 10 ) . 1 2 3 4 5 6 7 8 9 10 11 12 . It's an interesting trick to know and it works on any number once the prime factors have been determined. I have tried using : - In[26]:= Product[Floor[1 + log_n [6], {n \[Element] Primes && n \[Element] Integers && n >= 2 && n <= 6}]] During evaluation of In[26]:= Product::argmu : "\[NoBreak]Product\[NoBreak] called with 1 \ argument; \[NoBreak]2\[NoBreak] or more arguments are expected. \ \!\(\*ButtonBox["\[RightSkeleton]", Appearance->{Automatic, None}, BaseStyle->"Link", ButtonData:>"paclet:ref/message/General/argmu", ButtonNote->"Product::argmu"]\)" Out[26]= Product[Floor[1 + log_n[6], {n \[Element] Primes && n \[Element] Integers && n >= 2 && n <= 6}]] In[28]:= Sum[log[Floor[1 + log_n [6], {n \[Element] Primes && n \[Element] Integers && n >= 2 && n <= 6}]]] During evaluation of In[28]:= Sum::argmu : "\[NoBreak]Sum\[NoBreak] called with 1 argument; \ \[NoBreak]2\[NoBreak] or more arguments are expected. \ \!\(\*ButtonBox["\[RightSkeleton]", Appearance->{Automatic, None}, BaseStyle->"Link", ButtonData:>"paclet:ref/message/General/argmu", ButtonNote->"Sum::argmu"]\)" Out[28]= Sum[log[Floor[1 + log_n[6], {n \[Element] Primes && n \[Element] Integers && n >= 2 && n <= 6}]]] In[21]:= FactorInteger [60] Out[21]= {{2, 2}, {3, 1}, {5, 1}} - A couple of things are obviously not working out. I want the log in the base of the primes up to 6, of the number 6. Not 6 multiplied by the log_p of nothing to the right. I'm new to using logs, so if this is correct then that's amazing. So I want to see a result more like : Floor[1+log_2(6)] x Floor[1+log_3(6) x Floor[1+log_5(6) = 12 And if I were to simply use FactorInteger, it gives the prime factors and their exponents in {} but doesn't really do the math for me. I'm actually going to be working with much larger LCM's once i have the basics down. I will actually only be concerned with the number of digits of the number of factors. So, later, instead of finding the Product, I will want to use " Sum[log_10[Floor[1+log_p(n)]] , where n is the last consecutive interger of the LCM (1,2,3,...,n), and p is a prime greater or equal to 1 and p is less than or equal to n . I figured that I could just skip 1 because Log_10(1) = 0 since this will not change the sum and I didn't want to confuse the computer with trying to find the exponent of 1 and also because 1 is technically not a prime, I could just as well exclude it. But it is counted as a factor, along with the number itself, using the method with the exponents even though an exponent for 1 is never given. It works so I guess I shouldn't dwell on it. If the elders will not grant me their great wisdom, I am determined to pay to get this done. URL: ,

 Subject (listing for 'programming help, finding factors of LCM') Author Date Posted programming help, finding factors of LCM JD 07/08/13 5:07pm Re: programming help, finding factors of LCM Bill Simpson 07/08/13 6:11pm
 Next Comment > Help | Reply To Topic