Skip to main content
deleted 16 characters in body
Source Link

R, 84 7878 72 bytes

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

a=scan();max((1:(b<-min(a)*max(a)))[-colSums(combn(outer(a,0:b),sum(!!a)))])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. Thanks to Cole Beck for suggesting outer with no "*" and colSums rather than `apply(...,2,sum)'.

A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-applycolSums(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

A slightly shorter version (7872 bytes) that most often takes too log or too much space to run on Try it online is

a=scan();max((1:(b<-prod(a)))[-applycolSums(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

R, 84 78 bytes

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

a=scan();max((1:(b<-min(a)*max(a)))[-colSums(combn(outer(a,0:b),sum(!!a)))])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. Thanks to Cole Beck for suggesting outer with no "*" and colSums rather than `apply(...,2,sum)'.

A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

A slightly shorter version (78 bytes) that most often takes too log or too much space to run on Try it online is

a=scan();max((1:(b<-prod(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

R, 84 78 72 bytes

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

a=scan();max((1:(b<-min(a)*max(a)))[-colSums(combn(outer(a,0:b),sum(!!a)))])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. Thanks to Cole Beck for suggesting outer with no "*" and colSums rather than `apply(...,2,sum)'.

A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-colSums(combn(outer(a,0:b),sum(!!a)))])

A slightly shorter version (72 bytes) that most often takes too log or too much space to run on Try it online is

a=scan();max((1:(b<-prod(a)))[-colSums(combn(outer(a,0:b),sum(!!a)))])
added 98 characters in body
Source Link

R, 84 bytes (78???)84 78 bytes

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

a=scan();max((1:(b<-min(a)*max(a)))[-applycolSums(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

Try it online!Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. Thanks to Cole Beck for suggesting outer with no "*" and colSums rather than `apply(...,2,sum)'.

A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

A slightly shorter version (78 bytes) that most often takes too log or too much space to run on Try it online is

a=scan();max((1:(b<-prod(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

R, 84 bytes (78???)

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

a=scan();max((1:(b<-min(a)*max(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

A slightly shorter version (78 bytes) that most often takes too log or too much space to run on Try it online is

a=scan();max((1:(b<-prod(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

R, 84 78 bytes

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

a=scan();max((1:(b<-min(a)*max(a)))[-colSums(combn(outer(a,0:b),sum(!!a)))])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. Thanks to Cole Beck for suggesting outer with no "*" and colSums rather than `apply(...,2,sum)'.

A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

A slightly shorter version (78 bytes) that most often takes too log or too much space to run on Try it online is

a=scan();max((1:(b<-prod(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])
added 6 characters in body
Source Link

R, 8684 bytes (78???)

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

functiona=scan(a)max;max((1:(b<-min(a)*max(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

A slightly shorter version (8078 bytes) that most often takes too log or too much space to run on Try it online is

functiona=scan(a)max;max((1:(b<-prod(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

R, 86 bytes

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

function(a)max((1:(b<-min(a)*max(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations within that range.

A slightly shorter version (80 bytes) that most often takes too log to run on Try it online is

function(a)max((1:(b<-prod(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

R, 84 bytes (78???)

For an arbitrary entry of coprimes, \$a_1, a_2,\ldots\$, Frobenius' amount is given by

a=scan();max((1:(b<-min(a)*max(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

Try it online!

since it is always smaller than the product of the extreme \$a_i\$'s. It is then a matter of combining all possible combinations (and more) within that range. A faster but longer (by two bytes) version only considers max(a):

a=scan();max((1:(min(a)*(b<-max(a))))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])

A slightly shorter version (78 bytes) that most often takes too log or too much space to run on Try it online is

a=scan();max((1:(b<-prod(a)))[-apply(combn(outer(a,0:b,"*"),sum(!!a)),2,sum)])
deleted 3 characters in body
Source Link
Loading
deleted 61 characters in body
Source Link
Loading
deleted 61 characters in body
Source Link
Loading
added 348 characters in body
Source Link
Loading
Source Link
Loading