MHB Solve for upperbound of a summation to find the nearest LCM to a given #

  • Thread starter Thread starter Jaded Dreamking
  • Start date Start date
  • Tags Tags
    Summation
AI Thread Summary
The discussion focuses on finding the least common multiple (LCM) of consecutive integers from 1 to n and determining the number of factors in such an LCM. While constructing an LCM and finding factors when n is known is straightforward, deconstructing a given LCM to find n is challenging. Several methods for calculating LCMs and factors are presented, including using the Prime Pi function, the Mangoldt function, and various Mathematica commands like DivisorSigma and Apply. The user expresses a desire to find the nearest LCM above or below a specific value, ideally around 10^(10^10). They also mention difficulties with certain equations and Mathematica code, suggesting that programming in Mathematica may be more complex than in Python or Matlab. Recommendations are made to seek assistance on Mathematica Stackexchange for more specialized help.
Jaded Dreamking
Messages
1
Reaction score
0
I've been doing some work with finding the LCM of consecutive integers (1-n) and the number of factors in such an LCM.
It's become easy to construct an LCM and find the factors when n is given.
However, to deconstruct a given LCM and find n is proving difficult.
I eventually would like to find the nearest LCM either above or below a value.
It would be nice to have the one above, but I could make due with the one below.

I've been provided with a few ways of doing this that I'd like to show
and see if anyone can show me
how to solve it algebraically or code for my objective.

The first uses Prime Pi.

Product[Prime^Floor[Log[Prime, 11]], {i, PrimePi[11]}]

Out: 27720

Product[Floor[1 + Log[Prime, 11]], {i, PrimePi[11]}]

Out: 96

Also, I'd like to note that if PrimePi[] exceeds the value of n (11), then it does not affect the outcome.
And for some reason, the "" would not copy and paste behind Prime. I had to enter that manually. A bug perhaps?
And my computer let me know :
"The Mathematica command giving the prime counting function for a \ number x is PrimePi[x], which works up to a maximum value of x approx 8*10^(13)."

The second uses the Mangoldt function to construct the LCM.

Product[E^MangoldtLambda[n],{n, 2, 11}]

Out: 27720

and then using DivisorSigma [0,LCM] to find divisors / factors :

DivisorSigma[0, Product[E^MangoldtLambda[n],{n, 2, 11}]]and then there's what I refer to as the Apply method:

Apply[LCM, Range[11]]

and then I use DivisorSigma with that like this:

DivisorSigma[0, Apply[LCM, Range[11]]]

and then there's what I refer to as the PrimeQ method for which I only know how to find factors with given n:

Times @@ Map[Floor[1 + Log[#, 11]] &, Select[Range[2, 11], PrimeQ]]

and then there's the Cyclotomic method

Product[Cyclotomic[n, 1],{n, 2, 11}]I've read a couple of equations that I haven't been able to implement in mathematica

One webpage said that the LCM of (1-n) is equal to

E^(n*(1 + \[Omicron]*1))

which is too high of math for me to understand.

Another one out of my reach is: Psi(x) = ln (1,2,3,...,x)
If not psi, then it might be a similar symbol like PolyGamma
I figured that I could then take e^Psi(x) to get the LCM of (1-n).

I estimated that the target objective, the LCM of (1-n) that is somewhere near 10^(10^10) :

Floor[1+Log10[LCM@@Range[2297]]]//AbsoluteTiming

{0.0156250,1000}

Floor[1+Log10[LCM@@Range[23013]]]//AbsoluteTiming

{0.1406250,9998}

Floor[1+Log10[LCM@@Range[230075]]]//AbsoluteTiming

{2.6406250,99997}

Floor[1+Log10[LCM@@Range[2302149]]]//AbsoluteTiming

{63.7500000,999997}

Floor[1+Log10[Floor[1+Log10[LCM@@Range[23021490000]]]]]//AbsoluteTiming

And this last bit of code I have tried to run overnight and my 32 bit confuser didn't give.

My last thought was that since log_a(xy) = log_a(x) + log_a(y), then I need to solve for n where:

Sum of Log_10(e^(MangoldtLambda(n))) => (10^10). I tried:

NSolve[[[\!\(\*UnderoverscriptBox[\(\\), \(x = 2\), \(\\)]\(Floor[1 + Log10[\([E^MangoldtLambda[x], {x, 2, \}]\)]]\)\)] >= 10^10], x]

but the code isn't working for me.:confused:
 
Physics news on Phys.org
Jaded Dreamking said:
I've been doing some work with finding the LCM of consecutive integers (1-n) and the number of factors in such an LCM.
It's become easy to construct an LCM and find the factors when n is given.
However, to deconstruct a given LCM and find n is proving difficult.
I eventually would like to find the nearest LCM either above or below a value.
It would be nice to have the one above, but I could make due with the one below.

I've been provided with a few ways of doing this that I'd like to show
and see if anyone can show me
how to solve it algebraically or code for my objective.

The first uses Prime Pi.

Product[Prime^Floor[Log[Prime, 11]], {i, PrimePi[11]}]

Out: 27720

Product[Floor[1 + Log[Prime, 11]], {i, PrimePi[11]}]

Out: 96

Also, I'd like to note that if PrimePi[] exceeds the value of n (11), then it does not affect the outcome.
And for some reason, the "" would not copy and paste behind Prime. I had to enter that manually. A bug perhaps?
And my computer let me know :
"The Mathematica command giving the prime counting function for a \ number x is PrimePi[x], which works up to a maximum value of x approx 8*10^(13)."

The second uses the Mangoldt function to construct the LCM.

Product[E^MangoldtLambda[n],{n, 2, 11}]

Out: 27720

and then using DivisorSigma [0,LCM] to find divisors / factors :

DivisorSigma[0, Product[E^MangoldtLambda[n],{n, 2, 11}]]and then there's what I refer to as the Apply method:

Apply[LCM, Range[11]]

and then I use DivisorSigma with that like this:

DivisorSigma[0, Apply[LCM, Range[11]]]

and then there's what I refer to as the PrimeQ method for which I only know how to find factors with given n:

Times @@ Map[Floor[1 + Log[#, 11]] &, Select[Range[2, 11], PrimeQ]]

and then there's the Cyclotomic method

Product[Cyclotomic[n, 1],{n, 2, 11}]I've read a couple of equations that I haven't been able to implement in mathematica

One webpage said that the LCM of (1-n) is equal to

E^(n*(1 + \[Omicron]*1))

which is too high of math for me to understand.

Another one out of my reach is: Psi(x) = ln (1,2,3,...,x)
If not psi, then it might be a similar symbol like PolyGamma
I figured that I could then take e^Psi(x) to get the LCM of (1-n).

I estimated that the target objective, the LCM of (1-n) that is somewhere near 10^(10^10) :

Floor[1+Log10[LCM@@Range[2297]]]//AbsoluteTiming

{0.0156250,1000}

Floor[1+Log10[LCM@@Range[23013]]]//AbsoluteTiming

{0.1406250,9998}

Floor[1+Log10[LCM@@Range[230075]]]//AbsoluteTiming

{2.6406250,99997}

Floor[1+Log10[LCM@@Range[2302149]]]//AbsoluteTiming

{63.7500000,999997}

Floor[1+Log10[Floor[1+Log10[LCM@@Range[23021490000]]]]]//AbsoluteTiming

And this last bit of code I have tried to run overnight and my 32 bit confuser didn't give.

My last thought was that since log_a(xy) = log_a(x) + log_a(y), then I need to solve for n where:

Sum of Log_10(e^(MangoldtLambda(n))) => (10^10). I tried:

NSolve[[[\!\(\*UnderoverscriptBox[\(\\), \(x = 2\), \(\\)]\(Floor[1 + Log10[\([E^MangoldtLambda[x], {x, 2, \}]\)]]\)\)] >= 10^10], x]

but the code isn't working for me.:confused:


Programming in Mathematica is doable, but I think more difficult than say Python or if you prefer Matlab. I think for what you are looking to do Python may be the way to go; otherwise, you should ask this question on Mathematica Stackexchange since Mathematica programming experts can be found there. I am not trying to detract from MHB but this question may linger a lot longer here compared to there.
 
Back
Top