Gold nugget storage
up vote
6
down vote
favorite
Given a positive integer, write it as the sum of numbers, where each of them is in $kin1,9,81,tin1,2,3,...,64$. How many numbers at least are used? Shortest code win.
Samples:
Input Output Method
1 1 1
2 1 2
64 1 64
65 2 64+1
72 1 72
343 2 342+1
576 1 576
577 2 576+1
5184 1 5184
46656 9 5184+5184+5184+5184+5184+5184+5184+5184+5184
5274 2 5184+90
code-golf
|
show 5 more comments
up vote
6
down vote
favorite
Given a positive integer, write it as the sum of numbers, where each of them is in $kin1,9,81,tin1,2,3,...,64$. How many numbers at least are used? Shortest code win.
Samples:
Input Output Method
1 1 1
2 1 2
64 1 64
65 2 64+1
72 1 72
343 2 342+1
576 1 576
577 2 576+1
5184 1 5184
46656 9 5184+5184+5184+5184+5184+5184+5184+5184+5184
5274 2 5184+90
code-golf
4
Could you give slightly more detail/put into words how the input results in the output?
– Quintec
Nov 11 at 16:45
2
If something requires clarification in the comments, it would be useful to edit the challenge to include that clarification
– trichoplax
Nov 11 at 16:52
4
Is it basically a sort of change-making problem ? With the coins denominations being in the set1,9,81 × 1...64
?
– digEmAll
Nov 11 at 17:01
2
Are you trying to minimize the number of items or number of stacks?
– fəˈnɛtɪk
Nov 11 at 17:02
3
I suggest adding5274 = 64*81 + 10*9
as a test case, this checks if answers take as many blocks as possible if there are more than 576 nuggets and get64*81 + 1*81 + 9*1
(as mine did)
– Black Owl Kai
Nov 11 at 21:03
|
show 5 more comments
up vote
6
down vote
favorite
up vote
6
down vote
favorite
Given a positive integer, write it as the sum of numbers, where each of them is in $kin1,9,81,tin1,2,3,...,64$. How many numbers at least are used? Shortest code win.
Samples:
Input Output Method
1 1 1
2 1 2
64 1 64
65 2 64+1
72 1 72
343 2 342+1
576 1 576
577 2 576+1
5184 1 5184
46656 9 5184+5184+5184+5184+5184+5184+5184+5184+5184
5274 2 5184+90
code-golf
Given a positive integer, write it as the sum of numbers, where each of them is in $kin1,9,81,tin1,2,3,...,64$. How many numbers at least are used? Shortest code win.
Samples:
Input Output Method
1 1 1
2 1 2
64 1 64
65 2 64+1
72 1 72
343 2 342+1
576 1 576
577 2 576+1
5184 1 5184
46656 9 5184+5184+5184+5184+5184+5184+5184+5184+5184
5274 2 5184+90
code-golf
code-golf
edited Nov 11 at 23:40
asked Nov 11 at 16:34
l4m2
4,6081634
4,6081634
4
Could you give slightly more detail/put into words how the input results in the output?
– Quintec
Nov 11 at 16:45
2
If something requires clarification in the comments, it would be useful to edit the challenge to include that clarification
– trichoplax
Nov 11 at 16:52
4
Is it basically a sort of change-making problem ? With the coins denominations being in the set1,9,81 × 1...64
?
– digEmAll
Nov 11 at 17:01
2
Are you trying to minimize the number of items or number of stacks?
– fəˈnɛtɪk
Nov 11 at 17:02
3
I suggest adding5274 = 64*81 + 10*9
as a test case, this checks if answers take as many blocks as possible if there are more than 576 nuggets and get64*81 + 1*81 + 9*1
(as mine did)
– Black Owl Kai
Nov 11 at 21:03
|
show 5 more comments
4
Could you give slightly more detail/put into words how the input results in the output?
– Quintec
Nov 11 at 16:45
2
If something requires clarification in the comments, it would be useful to edit the challenge to include that clarification
– trichoplax
Nov 11 at 16:52
4
Is it basically a sort of change-making problem ? With the coins denominations being in the set1,9,81 × 1...64
?
– digEmAll
Nov 11 at 17:01
2
Are you trying to minimize the number of items or number of stacks?
– fəˈnɛtɪk
Nov 11 at 17:02
3
I suggest adding5274 = 64*81 + 10*9
as a test case, this checks if answers take as many blocks as possible if there are more than 576 nuggets and get64*81 + 1*81 + 9*1
(as mine did)
– Black Owl Kai
Nov 11 at 21:03
4
4
Could you give slightly more detail/put into words how the input results in the output?
– Quintec
Nov 11 at 16:45
Could you give slightly more detail/put into words how the input results in the output?
– Quintec
Nov 11 at 16:45
2
2
If something requires clarification in the comments, it would be useful to edit the challenge to include that clarification
– trichoplax
Nov 11 at 16:52
If something requires clarification in the comments, it would be useful to edit the challenge to include that clarification
– trichoplax
Nov 11 at 16:52
4
4
Is it basically a sort of change-making problem ? With the coins denominations being in the set
1,9,81 × 1...64
?– digEmAll
Nov 11 at 17:01
Is it basically a sort of change-making problem ? With the coins denominations being in the set
1,9,81 × 1...64
?– digEmAll
Nov 11 at 17:01
2
2
Are you trying to minimize the number of items or number of stacks?
– fəˈnɛtɪk
Nov 11 at 17:02
Are you trying to minimize the number of items or number of stacks?
– fəˈnɛtɪk
Nov 11 at 17:02
3
3
I suggest adding
5274 = 64*81 + 10*9
as a test case, this checks if answers take as many blocks as possible if there are more than 576 nuggets and get 64*81 + 1*81 + 9*1
(as mine did)– Black Owl Kai
Nov 11 at 21:03
I suggest adding
5274 = 64*81 + 10*9
as a test case, this checks if answers take as many blocks as possible if there are more than 576 nuggets and get 64*81 + 1*81 + 9*1
(as mine did)– Black Owl Kai
Nov 11 at 21:03
|
show 5 more comments
5 Answers
5
active
oldest
votes
up vote
3
down vote
Jelly, 17 bytes
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ
Try it online!
-1 thanks to Jonathan Allan.
Explanation (you can't test for inputs larger than 58
over TIO):
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ Arguments: x
64R [1..64]
×9;Ɗ Multiply by 9, prepend to original list
⁺ Do the above once more
Œṗ Positive integer partitions of x
¥@ Call with reversed arguments (x = partitions, y = flattened outer product)
f€ For each partition in x, keep the elements that are in y
f Keep the elements of x that have remained intact after the above
Ẉ Lengths of the remaining partitions
Ṃ Minimum
Since the output in testable area is trivial, can't quite check?
– l4m2
Nov 11 at 23:35
@l4m2 You can't do so over TIO, but you might be able to do so if you install Jelly locally. That's why I've added the explanation.
– Erik the Outgolfer
Nov 12 at 8:37
add a comment |
up vote
2
down vote
Perl 6, 47 bytes
+($_,(*X-(1,9,81 X*^65)).grep(*>=0).min...^0)
Try it online!
A greedy algorithm seems to work.
add a comment |
up vote
2
down vote
JavaScript (ES6), 72 66 57 56 bytes
Saved 1 byte thanks to @nwellnhof
f=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n>719?81:72):n-5184)
Try it online!
@nwellnhof This would fail for several values (576, 632, 633, ...)
– Arnauld
Nov 11 at 21:57
I see. Butf=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n<648?72:81):n-5184)
(56 bytes) should work, right?
– nwellnhof
Nov 11 at 22:59
@nwellnhof Yes, it does. :)
– Arnauld
Nov 11 at 23:37
add a comment |
up vote
2
down vote
05AB1E, 30 27 bytes
ŽK≠‰`91vDy64*›i1sy9*%]64/îO
Try it online! or verify all test cases
-3 bytes thanks to Kevin Cruijssen
This is my first 05AB1E submission, so I am sure that this can be optimized.
1
Not sure why you opted to choose the legacy version, since your answer also works in the new Elixir rewrite, but in the new version5184
can beŽK≠
. In addition, theS
after91
can be removed since it's done implicitly; and}}
can be]
(although you'd still need}}
in your test suite on TIO). Try it online or verify all test cases.
– Kevin Cruijssen
Nov 12 at 7:31
@KevinCruijssen I used the legacy version because tio.run/#05ab1e redirects there and because I didn't know about multiple versions.Thanks for the tips!
– Black Owl Kai
Nov 12 at 7:56
Ah, I see. The legacy version is written in Python, and was used for the past few years. A few months back the Elixir rewrite was released as new version, with loads of new features. Some builtins have changed slightly, so I do still use the legacy version sometimes, but I mostly use the new version now. :) PS: If you haven't seen it yet: Tips for golfing in 05AB1E might be interesting to read through. And feel free to ask anything in the 05AB1E chat if you need help.
– Kevin Cruijssen
Nov 12 at 8:00
add a comment |
up vote
0
down vote
Wolfram Language (Mathematica), 66 bytes
Min[Length/@IntegerPartitions[#,All,Union[#,9#,81#]&@Range@64,#]]&
Try it online!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175710%2fgold-nugget-storage%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
Jelly, 17 bytes
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ
Try it online!
-1 thanks to Jonathan Allan.
Explanation (you can't test for inputs larger than 58
over TIO):
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ Arguments: x
64R [1..64]
×9;Ɗ Multiply by 9, prepend to original list
⁺ Do the above once more
Œṗ Positive integer partitions of x
¥@ Call with reversed arguments (x = partitions, y = flattened outer product)
f€ For each partition in x, keep the elements that are in y
f Keep the elements of x that have remained intact after the above
Ẉ Lengths of the remaining partitions
Ṃ Minimum
Since the output in testable area is trivial, can't quite check?
– l4m2
Nov 11 at 23:35
@l4m2 You can't do so over TIO, but you might be able to do so if you install Jelly locally. That's why I've added the explanation.
– Erik the Outgolfer
Nov 12 at 8:37
add a comment |
up vote
3
down vote
Jelly, 17 bytes
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ
Try it online!
-1 thanks to Jonathan Allan.
Explanation (you can't test for inputs larger than 58
over TIO):
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ Arguments: x
64R [1..64]
×9;Ɗ Multiply by 9, prepend to original list
⁺ Do the above once more
Œṗ Positive integer partitions of x
¥@ Call with reversed arguments (x = partitions, y = flattened outer product)
f€ For each partition in x, keep the elements that are in y
f Keep the elements of x that have remained intact after the above
Ẉ Lengths of the remaining partitions
Ṃ Minimum
Since the output in testable area is trivial, can't quite check?
– l4m2
Nov 11 at 23:35
@l4m2 You can't do so over TIO, but you might be able to do so if you install Jelly locally. That's why I've added the explanation.
– Erik the Outgolfer
Nov 12 at 8:37
add a comment |
up vote
3
down vote
up vote
3
down vote
Jelly, 17 bytes
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ
Try it online!
-1 thanks to Jonathan Allan.
Explanation (you can't test for inputs larger than 58
over TIO):
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ Arguments: x
64R [1..64]
×9;Ɗ Multiply by 9, prepend to original list
⁺ Do the above once more
Œṗ Positive integer partitions of x
¥@ Call with reversed arguments (x = partitions, y = flattened outer product)
f€ For each partition in x, keep the elements that are in y
f Keep the elements of x that have remained intact after the above
Ẉ Lengths of the remaining partitions
Ṃ Minimum
Jelly, 17 bytes
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ
Try it online!
-1 thanks to Jonathan Allan.
Explanation (you can't test for inputs larger than 58
over TIO):
64R×9;Ɗ⁺ff€¥@ŒṗẈṂ Arguments: x
64R [1..64]
×9;Ɗ Multiply by 9, prepend to original list
⁺ Do the above once more
Œṗ Positive integer partitions of x
¥@ Call with reversed arguments (x = partitions, y = flattened outer product)
f€ For each partition in x, keep the elements that are in y
f Keep the elements of x that have remained intact after the above
Ẉ Lengths of the remaining partitions
Ṃ Minimum
edited Nov 11 at 20:15
answered Nov 11 at 18:34
Erik the Outgolfer
31.1k429102
31.1k429102
Since the output in testable area is trivial, can't quite check?
– l4m2
Nov 11 at 23:35
@l4m2 You can't do so over TIO, but you might be able to do so if you install Jelly locally. That's why I've added the explanation.
– Erik the Outgolfer
Nov 12 at 8:37
add a comment |
Since the output in testable area is trivial, can't quite check?
– l4m2
Nov 11 at 23:35
@l4m2 You can't do so over TIO, but you might be able to do so if you install Jelly locally. That's why I've added the explanation.
– Erik the Outgolfer
Nov 12 at 8:37
Since the output in testable area is trivial, can't quite check?
– l4m2
Nov 11 at 23:35
Since the output in testable area is trivial, can't quite check?
– l4m2
Nov 11 at 23:35
@l4m2 You can't do so over TIO, but you might be able to do so if you install Jelly locally. That's why I've added the explanation.
– Erik the Outgolfer
Nov 12 at 8:37
@l4m2 You can't do so over TIO, but you might be able to do so if you install Jelly locally. That's why I've added the explanation.
– Erik the Outgolfer
Nov 12 at 8:37
add a comment |
up vote
2
down vote
Perl 6, 47 bytes
+($_,(*X-(1,9,81 X*^65)).grep(*>=0).min...^0)
Try it online!
A greedy algorithm seems to work.
add a comment |
up vote
2
down vote
Perl 6, 47 bytes
+($_,(*X-(1,9,81 X*^65)).grep(*>=0).min...^0)
Try it online!
A greedy algorithm seems to work.
add a comment |
up vote
2
down vote
up vote
2
down vote
Perl 6, 47 bytes
+($_,(*X-(1,9,81 X*^65)).grep(*>=0).min...^0)
Try it online!
A greedy algorithm seems to work.
Perl 6, 47 bytes
+($_,(*X-(1,9,81 X*^65)).grep(*>=0).min...^0)
Try it online!
A greedy algorithm seems to work.
answered Nov 11 at 23:36
nwellnhof
6,4431125
6,4431125
add a comment |
add a comment |
up vote
2
down vote
JavaScript (ES6), 72 66 57 56 bytes
Saved 1 byte thanks to @nwellnhof
f=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n>719?81:72):n-5184)
Try it online!
@nwellnhof This would fail for several values (576, 632, 633, ...)
– Arnauld
Nov 11 at 21:57
I see. Butf=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n<648?72:81):n-5184)
(56 bytes) should work, right?
– nwellnhof
Nov 11 at 22:59
@nwellnhof Yes, it does. :)
– Arnauld
Nov 11 at 23:37
add a comment |
up vote
2
down vote
JavaScript (ES6), 72 66 57 56 bytes
Saved 1 byte thanks to @nwellnhof
f=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n>719?81:72):n-5184)
Try it online!
@nwellnhof This would fail for several values (576, 632, 633, ...)
– Arnauld
Nov 11 at 21:57
I see. Butf=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n<648?72:81):n-5184)
(56 bytes) should work, right?
– nwellnhof
Nov 11 at 22:59
@nwellnhof Yes, it does. :)
– Arnauld
Nov 11 at 23:37
add a comment |
up vote
2
down vote
up vote
2
down vote
JavaScript (ES6), 72 66 57 56 bytes
Saved 1 byte thanks to @nwellnhof
f=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n>719?81:72):n-5184)
Try it online!
JavaScript (ES6), 72 66 57 56 bytes
Saved 1 byte thanks to @nwellnhof
f=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n>719?81:72):n-5184)
Try it online!
edited Nov 11 at 23:37
answered Nov 11 at 18:04
Arnauld
71.5k688299
71.5k688299
@nwellnhof This would fail for several values (576, 632, 633, ...)
– Arnauld
Nov 11 at 21:57
I see. Butf=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n<648?72:81):n-5184)
(56 bytes) should work, right?
– nwellnhof
Nov 11 at 22:59
@nwellnhof Yes, it does. :)
– Arnauld
Nov 11 at 23:37
add a comment |
@nwellnhof This would fail for several values (576, 632, 633, ...)
– Arnauld
Nov 11 at 21:57
I see. Butf=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n<648?72:81):n-5184)
(56 bytes) should work, right?
– nwellnhof
Nov 11 at 22:59
@nwellnhof Yes, it does. :)
– Arnauld
Nov 11 at 23:37
@nwellnhof This would fail for several values (576, 632, 633, ...)
– Arnauld
Nov 11 at 21:57
@nwellnhof This would fail for several values (576, 632, 633, ...)
– Arnauld
Nov 11 at 21:57
I see. But
f=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n<648?72:81):n-5184)
(56 bytes) should work, right?– nwellnhof
Nov 11 at 22:59
I see. But
f=n=>n&&1+f(n<5184?n>64&&n%(n<576?9:n<648?72:81):n-5184)
(56 bytes) should work, right?– nwellnhof
Nov 11 at 22:59
@nwellnhof Yes, it does. :)
– Arnauld
Nov 11 at 23:37
@nwellnhof Yes, it does. :)
– Arnauld
Nov 11 at 23:37
add a comment |
up vote
2
down vote
05AB1E, 30 27 bytes
ŽK≠‰`91vDy64*›i1sy9*%]64/îO
Try it online! or verify all test cases
-3 bytes thanks to Kevin Cruijssen
This is my first 05AB1E submission, so I am sure that this can be optimized.
1
Not sure why you opted to choose the legacy version, since your answer also works in the new Elixir rewrite, but in the new version5184
can beŽK≠
. In addition, theS
after91
can be removed since it's done implicitly; and}}
can be]
(although you'd still need}}
in your test suite on TIO). Try it online or verify all test cases.
– Kevin Cruijssen
Nov 12 at 7:31
@KevinCruijssen I used the legacy version because tio.run/#05ab1e redirects there and because I didn't know about multiple versions.Thanks for the tips!
– Black Owl Kai
Nov 12 at 7:56
Ah, I see. The legacy version is written in Python, and was used for the past few years. A few months back the Elixir rewrite was released as new version, with loads of new features. Some builtins have changed slightly, so I do still use the legacy version sometimes, but I mostly use the new version now. :) PS: If you haven't seen it yet: Tips for golfing in 05AB1E might be interesting to read through. And feel free to ask anything in the 05AB1E chat if you need help.
– Kevin Cruijssen
Nov 12 at 8:00
add a comment |
up vote
2
down vote
05AB1E, 30 27 bytes
ŽK≠‰`91vDy64*›i1sy9*%]64/îO
Try it online! or verify all test cases
-3 bytes thanks to Kevin Cruijssen
This is my first 05AB1E submission, so I am sure that this can be optimized.
1
Not sure why you opted to choose the legacy version, since your answer also works in the new Elixir rewrite, but in the new version5184
can beŽK≠
. In addition, theS
after91
can be removed since it's done implicitly; and}}
can be]
(although you'd still need}}
in your test suite on TIO). Try it online or verify all test cases.
– Kevin Cruijssen
Nov 12 at 7:31
@KevinCruijssen I used the legacy version because tio.run/#05ab1e redirects there and because I didn't know about multiple versions.Thanks for the tips!
– Black Owl Kai
Nov 12 at 7:56
Ah, I see. The legacy version is written in Python, and was used for the past few years. A few months back the Elixir rewrite was released as new version, with loads of new features. Some builtins have changed slightly, so I do still use the legacy version sometimes, but I mostly use the new version now. :) PS: If you haven't seen it yet: Tips for golfing in 05AB1E might be interesting to read through. And feel free to ask anything in the 05AB1E chat if you need help.
– Kevin Cruijssen
Nov 12 at 8:00
add a comment |
up vote
2
down vote
up vote
2
down vote
05AB1E, 30 27 bytes
ŽK≠‰`91vDy64*›i1sy9*%]64/îO
Try it online! or verify all test cases
-3 bytes thanks to Kevin Cruijssen
This is my first 05AB1E submission, so I am sure that this can be optimized.
05AB1E, 30 27 bytes
ŽK≠‰`91vDy64*›i1sy9*%]64/îO
Try it online! or verify all test cases
-3 bytes thanks to Kevin Cruijssen
This is my first 05AB1E submission, so I am sure that this can be optimized.
edited Nov 12 at 7:56
answered Nov 11 at 20:34
Black Owl Kai
5717
5717
1
Not sure why you opted to choose the legacy version, since your answer also works in the new Elixir rewrite, but in the new version5184
can beŽK≠
. In addition, theS
after91
can be removed since it's done implicitly; and}}
can be]
(although you'd still need}}
in your test suite on TIO). Try it online or verify all test cases.
– Kevin Cruijssen
Nov 12 at 7:31
@KevinCruijssen I used the legacy version because tio.run/#05ab1e redirects there and because I didn't know about multiple versions.Thanks for the tips!
– Black Owl Kai
Nov 12 at 7:56
Ah, I see. The legacy version is written in Python, and was used for the past few years. A few months back the Elixir rewrite was released as new version, with loads of new features. Some builtins have changed slightly, so I do still use the legacy version sometimes, but I mostly use the new version now. :) PS: If you haven't seen it yet: Tips for golfing in 05AB1E might be interesting to read through. And feel free to ask anything in the 05AB1E chat if you need help.
– Kevin Cruijssen
Nov 12 at 8:00
add a comment |
1
Not sure why you opted to choose the legacy version, since your answer also works in the new Elixir rewrite, but in the new version5184
can beŽK≠
. In addition, theS
after91
can be removed since it's done implicitly; and}}
can be]
(although you'd still need}}
in your test suite on TIO). Try it online or verify all test cases.
– Kevin Cruijssen
Nov 12 at 7:31
@KevinCruijssen I used the legacy version because tio.run/#05ab1e redirects there and because I didn't know about multiple versions.Thanks for the tips!
– Black Owl Kai
Nov 12 at 7:56
Ah, I see. The legacy version is written in Python, and was used for the past few years. A few months back the Elixir rewrite was released as new version, with loads of new features. Some builtins have changed slightly, so I do still use the legacy version sometimes, but I mostly use the new version now. :) PS: If you haven't seen it yet: Tips for golfing in 05AB1E might be interesting to read through. And feel free to ask anything in the 05AB1E chat if you need help.
– Kevin Cruijssen
Nov 12 at 8:00
1
1
Not sure why you opted to choose the legacy version, since your answer also works in the new Elixir rewrite, but in the new version
5184
can be ŽK≠
. In addition, the S
after 91
can be removed since it's done implicitly; and }}
can be ]
(although you'd still need }}
in your test suite on TIO). Try it online or verify all test cases.– Kevin Cruijssen
Nov 12 at 7:31
Not sure why you opted to choose the legacy version, since your answer also works in the new Elixir rewrite, but in the new version
5184
can be ŽK≠
. In addition, the S
after 91
can be removed since it's done implicitly; and }}
can be ]
(although you'd still need }}
in your test suite on TIO). Try it online or verify all test cases.– Kevin Cruijssen
Nov 12 at 7:31
@KevinCruijssen I used the legacy version because tio.run/#05ab1e redirects there and because I didn't know about multiple versions.Thanks for the tips!
– Black Owl Kai
Nov 12 at 7:56
@KevinCruijssen I used the legacy version because tio.run/#05ab1e redirects there and because I didn't know about multiple versions.Thanks for the tips!
– Black Owl Kai
Nov 12 at 7:56
Ah, I see. The legacy version is written in Python, and was used for the past few years. A few months back the Elixir rewrite was released as new version, with loads of new features. Some builtins have changed slightly, so I do still use the legacy version sometimes, but I mostly use the new version now. :) PS: If you haven't seen it yet: Tips for golfing in 05AB1E might be interesting to read through. And feel free to ask anything in the 05AB1E chat if you need help.
– Kevin Cruijssen
Nov 12 at 8:00
Ah, I see. The legacy version is written in Python, and was used for the past few years. A few months back the Elixir rewrite was released as new version, with loads of new features. Some builtins have changed slightly, so I do still use the legacy version sometimes, but I mostly use the new version now. :) PS: If you haven't seen it yet: Tips for golfing in 05AB1E might be interesting to read through. And feel free to ask anything in the 05AB1E chat if you need help.
– Kevin Cruijssen
Nov 12 at 8:00
add a comment |
up vote
0
down vote
Wolfram Language (Mathematica), 66 bytes
Min[Length/@IntegerPartitions[#,All,Union[#,9#,81#]&@Range@64,#]]&
Try it online!
add a comment |
up vote
0
down vote
Wolfram Language (Mathematica), 66 bytes
Min[Length/@IntegerPartitions[#,All,Union[#,9#,81#]&@Range@64,#]]&
Try it online!
add a comment |
up vote
0
down vote
up vote
0
down vote
Wolfram Language (Mathematica), 66 bytes
Min[Length/@IntegerPartitions[#,All,Union[#,9#,81#]&@Range@64,#]]&
Try it online!
Wolfram Language (Mathematica), 66 bytes
Min[Length/@IntegerPartitions[#,All,Union[#,9#,81#]&@Range@64,#]]&
Try it online!
answered Nov 12 at 11:01
alephalpha
21k32888
21k32888
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175710%2fgold-nugget-storage%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Could you give slightly more detail/put into words how the input results in the output?
– Quintec
Nov 11 at 16:45
2
If something requires clarification in the comments, it would be useful to edit the challenge to include that clarification
– trichoplax
Nov 11 at 16:52
4
Is it basically a sort of change-making problem ? With the coins denominations being in the set
1,9,81 × 1...64
?– digEmAll
Nov 11 at 17:01
2
Are you trying to minimize the number of items or number of stacks?
– fəˈnɛtɪk
Nov 11 at 17:02
3
I suggest adding
5274 = 64*81 + 10*9
as a test case, this checks if answers take as many blocks as possible if there are more than 576 nuggets and get64*81 + 1*81 + 9*1
(as mine did)– Black Owl Kai
Nov 11 at 21:03