10

Wolfram Language (Mathematica), 44 bytes Max[PermutationOrder/@Permutations@Range@#]& Try it online! Wolfram Language (Mathematica), 31 bytes @DanielSchepler has a better solution: Max[LCM@@@IntegerPartitions@#]& Try it online!


9

05AB1E, 6 bytes Åœ€.¿Z Try it online! Åœ # integer partitions of the input €.¿ # lcm of each Z # maximum


7

Python 2, 38 bytes lambda n,k,m:m>n-k<2or-1<k*m-n<2+2/m*k Try it online! Characterizes the cases where there's only one legal partition. Consider the partitions of \$n\$ into exactly \$k\$ parts each between \$1\$ and \$m\$ inclusive. There's only two ways to for there to be only one such partition. The number \$n\$ is close to as small as ...


4

Python, 87 bytes f=lambda n,d=1:max([f(m,min(range(d,d<<n,d),key=(n-m).__rmod__))for m in range(n)]+[d]) Try it online! A recursive function that tracks the remaining n to partition and the running LCM d. Note that this means we don't need to track the actual numbers in the partition or how many of them we've used. We try each possible next part, n-...


4

Haskell, 44 bytes (%1) n%t=maximum$t:[(n-d)%lcm t d|d<-[1..n]] Try it online!


4

Haskell, 57 bytes f(h:t)=sum[f l|l<-mapM(\n->[0..n])t,sum t-sum l==h] f _=1 Try it online!


3

Perl 6, 50 bytes {max .map:{+(.[$_],{.[@^a]}...$_,)}}o&permutations Try it online! Checks all permutations directly, like @histocrat's Ruby solution. Explanation &permutations # Permutations of [0;n) { }o # Feed into block .map:{ } # Map ...


3

JavaScript (ES6), 92 bytes Computes the maximum value of \$\operatorname{lcm}(a_1,\ldots,a_k)\$ where \$a_1+\ldots+a_k\$ is a partition of \$n\$. f=(n,i=1,l=m=0)=>n?i>n?m:f(n-i,i,l*i/(G=(a,b)=>b?G(b,a%b):a)(l,i)||i)&f(n,i+1,l)|m:m=l>m?l:m Try it online! JavaScript (ES6), 95 bytes f=(n,i=1,m)=>i>>n?m:f(n,i+1,i<m|(g=(n,k=2,p=0)=...


3

Jelly, 7 bytes Œṗæl/€Ṁ Try it online! A monadic link taking an integer as its argument and returning an integer. Explanation Œṗ | Integer partitions æl/€ | Reduce each using LCM Ṁ | Maximum


3

Haskell, 75 bytes f(h:t)=sum$f<$>h%t f[]=1 r%(h:t)=[h-i:x|i<-[0..r],x<-(r-i)%t] r%_=[[]|r==0] Try it online! It's faster (and easier to understand) when i<-[0..r] is replaced by i<-[0..min r h]. Also, it's faster to give the degrees (whose order obviously doesn't matter) in increasing order.


3

Haskell, 127 bytes e=[]:e h a b=mapM id$b<$a f a=length[0|x<-h a$h a[0..maximum a],x==foldr(zipWith(:))e x,all(<1)$zipWith(!!)x[0..],map sum x==a] Try it online! Very very inefficient (superexponential), but I believe it should work in theory. Exceeds Tio's 60 second limit with [3, 3, 1, 1] as input, but works with [1, 1, 1, 1]. Considers the ...


2

Wolfram Language (Mathematica), 39 38 bytes -1: first argument > other arguments (no length-1 partitions) 1==Tr[1^IntegerPartitions[#,{#2},#3]]& Try it online!


2

05AB1E, 8 bytes ÅœIù€à@O Try it online! Outputs truthy when there’s exactly one partition, falsy otherwise. (All numbers except 1 are falsy in 05AB1E, which makes this convenient). Åœ # integer partitions of the first input Iù # keep only those with length equal to the second input €à # take the ...


2

Jelly, (10?) 11 bytes Œṗṁ«⁵ɗƑƇL⁼1 A full program which accepts N numberOfParts maximalSizeOfAnyPart as arguments and prints 1 if exactly one solution exists and 0 otherwise. Try it online! How? Œṗṁ«⁵ɗƑƇL⁼1 - Main Link: N, numberOfParts Œṗ - integer partitions (of N) Ƈ - keep those (P) for which: Ƒ - is invariant under: ...


2

Haskell, 70 67 bytes f n=maximum[foldl1 lcm a|k<-[1..n],a<-mapM id$[1..n]<$[1..k],sum a==n] Try it online! Edit: -3 bytes thanks to @xnor.


2

Ruby, 77 bytes f=->n{a=*0...n;a.permutation.map{|p|(1..).find{a.map!{|i|p[i]}==a.sort}}.max} Try it online! (1..) infinite range syntax is too new for TIO, so the link sets an arbitrary upper bound. This uses the direct definition--enumerate all possible permutations, then test each one by mutating a until it gets back to its original position (which ...


2

Gaia, 25 23 22 bytes ,:Π¤d¦&⊢⌉/ 1w&ḍΣ¦¦⇈⊢¦⌉ Try it online! Not having LCM or integer partitions makes this approach rather long. ,:Π¤d¦&⊢⌉/ ;* helper function: LCM of 2 inputs 1w&ḍΣ¦¦ ;* push integer partitions ¦ ;* for each ⇈⊢ ;* Reduce by helper function ⌉ ;* and take the max


1

Python 3 + numpy, 115 102 99 bytes -13 bytes thanks to @Daniel Shepler -3 more bytes from @Daniel Shepler import numpy c=lambda n:[n]+[numpy.lcm(i,j)for i in range(1,n)for j in c(n-i)] l=lambda n:max(c(n)) Try it online! Brute force method: find all possible sequences a,b,c,... where a+b+c+...=n, then pick the one with the highest lcm.


1

Jelly, 7 bytes œċ§ċ⁵=1 Try it online! A full program taking the arguments in the order maximum part, number of parts, sum (i.e. reversed from original question). Explanation œċ | Combinations with replacement (using maximum part size and number of parts) § | Sum (vectorises) ċ⁵ | Count occurrences of desired integer from question =...


1

Whitespace, 111 bytes [S S S N _Push_0][S N S _Duplicate_0][T N T T _Read_integer_from_STDIN][T T T _Retrieve_input][S S S T S S S N _Push_8][T S S N _Multiply][S S S T N _Push_1][T S S S _Add][S S T T N _Push_n=-1][N S S N _Create_Label_SQRT_LOOP][S S S T N _Push_1][T S S S _Add][S N S _Duplicate_n][S N S _Duplicate_n][T S S N ...


1

J, 11 bytes 2&!inv<.@-* Try it online! 2&!inv solve [x choose 2 = input] -* minus 1 <. and floor


1

Python 3, 106 bytes lambda n:[(a,b,n-a-b)for a in range(n)for b in range(n)if all(f'{x}'==f'{x}'[::-1]for x in(a,b,n-a-b))][0] Try it online! In the TIO link I used a faster (but 1 byte longer version) that takes the first valid result as a generator, rather than building the entire list of possible combinations and taking the first.


1

Perl 6, 51 bytes {first *.sum==$_,[X] 3 Rxx grep {$_ eq.flip},1..$_} Try it online! grep { $_ eq .flip }, 1 .. $_ produces a list of all palindromic numbers from 1 to the input number. 3 Rxx replicates that list three times. [X] reduces that list-of-lists with the cross-product operator X, resulting in a list of all 3-tuples of palindrominc numbers from 1 ...


1

05AB1E, 8 bytes ÅœR.ΔDíQ Try it online! Explanation: Åœ # integer partitions of the input R # reversed (puts the shortest ones first) .Δ # find the first one that... D Q # is equal to... í # itself with each element reversed


Only top voted, non community-wiki answers of a minimum length are eligible