Which big number is bigger?
$begingroup$
Input
Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20.
Output
True if a1^(a2^a3) > b1^(b2^b3) and False otherwise.
^ is exponentiation in this question.
Rules
This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop PC.
You can output anything Truthy for True and anything Falsey for False.
Test cases
3^(4^5) > 5^(4^3)
1^(2^3) < 3^(2^1)
3^(6^5) < 5^(20^3)
20^(20^20) > 20^(20^19)
20^(20^20) is not bigger than 20^(20^20)
code-golf
$endgroup$
add a comment |
$begingroup$
Input
Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20.
Output
True if a1^(a2^a3) > b1^(b2^b3) and False otherwise.
^ is exponentiation in this question.
Rules
This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop PC.
You can output anything Truthy for True and anything Falsey for False.
Test cases
3^(4^5) > 5^(4^3)
1^(2^3) < 3^(2^1)
3^(6^5) < 5^(20^3)
20^(20^20) > 20^(20^19)
20^(20^20) is not bigger than 20^(20^20)
code-golf
$endgroup$
1
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to1
and0
$endgroup$
– Unrelated String
21 mins ago
1
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
20 mins ago
$begingroup$
@KevinCruijssen No. They have to be in the order given.
$endgroup$
– Anush
17 mins ago
1
$begingroup$
Suggested test case to make sure that all solutions can support high values:20^(20^20) > 19^(20^20)
.
$endgroup$
– Arnauld
5 mins ago
$begingroup$
Suggested test case: wherea1,a2,a3
are equal tob1,b2,b3
, which should result in falsey.
$endgroup$
– Kevin Cruijssen
4 mins ago
add a comment |
$begingroup$
Input
Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20.
Output
True if a1^(a2^a3) > b1^(b2^b3) and False otherwise.
^ is exponentiation in this question.
Rules
This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop PC.
You can output anything Truthy for True and anything Falsey for False.
Test cases
3^(4^5) > 5^(4^3)
1^(2^3) < 3^(2^1)
3^(6^5) < 5^(20^3)
20^(20^20) > 20^(20^19)
20^(20^20) is not bigger than 20^(20^20)
code-golf
$endgroup$
Input
Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20.
Output
True if a1^(a2^a3) > b1^(b2^b3) and False otherwise.
^ is exponentiation in this question.
Rules
This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop PC.
You can output anything Truthy for True and anything Falsey for False.
Test cases
3^(4^5) > 5^(4^3)
1^(2^3) < 3^(2^1)
3^(6^5) < 5^(20^3)
20^(20^20) > 20^(20^19)
20^(20^20) is not bigger than 20^(20^20)
code-golf
code-golf
edited 51 secs ago
Anush
asked 24 mins ago
AnushAnush
849627
849627
1
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to1
and0
$endgroup$
– Unrelated String
21 mins ago
1
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
20 mins ago
$begingroup$
@KevinCruijssen No. They have to be in the order given.
$endgroup$
– Anush
17 mins ago
1
$begingroup$
Suggested test case to make sure that all solutions can support high values:20^(20^20) > 19^(20^20)
.
$endgroup$
– Arnauld
5 mins ago
$begingroup$
Suggested test case: wherea1,a2,a3
are equal tob1,b2,b3
, which should result in falsey.
$endgroup$
– Kevin Cruijssen
4 mins ago
add a comment |
1
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to1
and0
$endgroup$
– Unrelated String
21 mins ago
1
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
20 mins ago
$begingroup$
@KevinCruijssen No. They have to be in the order given.
$endgroup$
– Anush
17 mins ago
1
$begingroup$
Suggested test case to make sure that all solutions can support high values:20^(20^20) > 19^(20^20)
.
$endgroup$
– Arnauld
5 mins ago
$begingroup$
Suggested test case: wherea1,a2,a3
are equal tob1,b2,b3
, which should result in falsey.
$endgroup$
– Kevin Cruijssen
4 mins ago
1
1
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to
1
and 0
$endgroup$
– Unrelated String
21 mins ago
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to
1
and 0
$endgroup$
– Unrelated String
21 mins ago
1
1
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
20 mins ago
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
20 mins ago
$begingroup$
@KevinCruijssen No. They have to be in the order given.
$endgroup$
– Anush
17 mins ago
$begingroup$
@KevinCruijssen No. They have to be in the order given.
$endgroup$
– Anush
17 mins ago
1
1
$begingroup$
Suggested test case to make sure that all solutions can support high values:
20^(20^20) > 19^(20^20)
.$endgroup$
– Arnauld
5 mins ago
$begingroup$
Suggested test case to make sure that all solutions can support high values:
20^(20^20) > 19^(20^20)
.$endgroup$
– Arnauld
5 mins ago
$begingroup$
Suggested test case: where
a1,a2,a3
are equal to b1,b2,b3
, which should result in falsey.$endgroup$
– Kevin Cruijssen
4 mins ago
$begingroup$
Suggested test case: where
a1,a2,a3
are equal to b1,b2,b3
, which should result in falsey.$endgroup$
– Kevin Cruijssen
4 mins ago
add a comment |
5 Answers
5
active
oldest
votes
$begingroup$
JavaScript (ES6), 43 bytes
Returns $true$ if $a^{b^c} > d^{e^f}$, or $false$ otherwise.
(a,b,c,d,e,f)=>b*c*(l=Math.log)(a)>e*f*l(d)
Try it online!
$endgroup$
$begingroup$
Eheh we had the same idea... and almost the same byte count :P
$endgroup$
– digEmAll
11 mins ago
add a comment |
$begingroup$
R, 42 bytes
function(a,b,c,d,e,f)log(a)*b*c>log(d)*e*f
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 6, 25 bytes
* **(* ** *)>* **(* ** *)
Try it online!
$endgroup$
$begingroup$
This doesn't work if all the variables are set to 20.
$endgroup$
– Anush
5 mins ago
$begingroup$
(20,20,20,20,20,20)
results in a number overflow error
$endgroup$
– Kevin Cruijssen
5 mins ago
add a comment |
$begingroup$
05AB1E, 11 bytes
Uses the method from Arnauld's JS answer
.²**U.²**X‹
Try it online!
2F.²**ˆ}¯`›
also works at the same byte count
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
15 mins ago
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
13 mins ago
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
13 mins ago
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
12 mins ago
$begingroup$
Yes, sorry. That is what I meant.
$endgroup$
– Anush
23 secs ago
add a comment |
$begingroup$
05AB1E, 11 bytes
2F.²**ˆ}¯`›
Input as six separated inputs.
Try it online.
Or alternatively:
εεN_i.²]P`›
Input as [[a1,a2,a3],[b1,b2,b3]]
.
Try it online.
$endgroup$
add a comment |
Your Answer
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',
autoActivateHeartbeat: false,
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%2f184734%2fwhich-big-number-is-bigger%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
$begingroup$
JavaScript (ES6), 43 bytes
Returns $true$ if $a^{b^c} > d^{e^f}$, or $false$ otherwise.
(a,b,c,d,e,f)=>b*c*(l=Math.log)(a)>e*f*l(d)
Try it online!
$endgroup$
$begingroup$
Eheh we had the same idea... and almost the same byte count :P
$endgroup$
– digEmAll
11 mins ago
add a comment |
$begingroup$
JavaScript (ES6), 43 bytes
Returns $true$ if $a^{b^c} > d^{e^f}$, or $false$ otherwise.
(a,b,c,d,e,f)=>b*c*(l=Math.log)(a)>e*f*l(d)
Try it online!
$endgroup$
$begingroup$
Eheh we had the same idea... and almost the same byte count :P
$endgroup$
– digEmAll
11 mins ago
add a comment |
$begingroup$
JavaScript (ES6), 43 bytes
Returns $true$ if $a^{b^c} > d^{e^f}$, or $false$ otherwise.
(a,b,c,d,e,f)=>b*c*(l=Math.log)(a)>e*f*l(d)
Try it online!
$endgroup$
JavaScript (ES6), 43 bytes
Returns $true$ if $a^{b^c} > d^{e^f}$, or $false$ otherwise.
(a,b,c,d,e,f)=>b*c*(l=Math.log)(a)>e*f*l(d)
Try it online!
answered 15 mins ago
ArnauldArnauld
82.1k798337
82.1k798337
$begingroup$
Eheh we had the same idea... and almost the same byte count :P
$endgroup$
– digEmAll
11 mins ago
add a comment |
$begingroup$
Eheh we had the same idea... and almost the same byte count :P
$endgroup$
– digEmAll
11 mins ago
$begingroup$
Eheh we had the same idea... and almost the same byte count :P
$endgroup$
– digEmAll
11 mins ago
$begingroup$
Eheh we had the same idea... and almost the same byte count :P
$endgroup$
– digEmAll
11 mins ago
add a comment |
$begingroup$
R, 42 bytes
function(a,b,c,d,e,f)log(a)*b*c>log(d)*e*f
Try it online!
$endgroup$
add a comment |
$begingroup$
R, 42 bytes
function(a,b,c,d,e,f)log(a)*b*c>log(d)*e*f
Try it online!
$endgroup$
add a comment |
$begingroup$
R, 42 bytes
function(a,b,c,d,e,f)log(a)*b*c>log(d)*e*f
Try it online!
$endgroup$
R, 42 bytes
function(a,b,c,d,e,f)log(a)*b*c>log(d)*e*f
Try it online!
answered 12 mins ago
digEmAlldigEmAll
3,654515
3,654515
add a comment |
add a comment |
$begingroup$
Perl 6, 25 bytes
* **(* ** *)>* **(* ** *)
Try it online!
$endgroup$
$begingroup$
This doesn't work if all the variables are set to 20.
$endgroup$
– Anush
5 mins ago
$begingroup$
(20,20,20,20,20,20)
results in a number overflow error
$endgroup$
– Kevin Cruijssen
5 mins ago
add a comment |
$begingroup$
Perl 6, 25 bytes
* **(* ** *)>* **(* ** *)
Try it online!
$endgroup$
$begingroup$
This doesn't work if all the variables are set to 20.
$endgroup$
– Anush
5 mins ago
$begingroup$
(20,20,20,20,20,20)
results in a number overflow error
$endgroup$
– Kevin Cruijssen
5 mins ago
add a comment |
$begingroup$
Perl 6, 25 bytes
* **(* ** *)>* **(* ** *)
Try it online!
$endgroup$
Perl 6, 25 bytes
* **(* ** *)>* **(* ** *)
Try it online!
answered 7 mins ago
Phil HPhil H
1,176817
1,176817
$begingroup$
This doesn't work if all the variables are set to 20.
$endgroup$
– Anush
5 mins ago
$begingroup$
(20,20,20,20,20,20)
results in a number overflow error
$endgroup$
– Kevin Cruijssen
5 mins ago
add a comment |
$begingroup$
This doesn't work if all the variables are set to 20.
$endgroup$
– Anush
5 mins ago
$begingroup$
(20,20,20,20,20,20)
results in a number overflow error
$endgroup$
– Kevin Cruijssen
5 mins ago
$begingroup$
This doesn't work if all the variables are set to 20.
$endgroup$
– Anush
5 mins ago
$begingroup$
This doesn't work if all the variables are set to 20.
$endgroup$
– Anush
5 mins ago
$begingroup$
(20,20,20,20,20,20)
results in a number overflow error$endgroup$
– Kevin Cruijssen
5 mins ago
$begingroup$
(20,20,20,20,20,20)
results in a number overflow error$endgroup$
– Kevin Cruijssen
5 mins ago
add a comment |
$begingroup$
05AB1E, 11 bytes
Uses the method from Arnauld's JS answer
.²**U.²**X‹
Try it online!
2F.²**ˆ}¯`›
also works at the same byte count
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
15 mins ago
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
13 mins ago
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
13 mins ago
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
12 mins ago
$begingroup$
Yes, sorry. That is what I meant.
$endgroup$
– Anush
23 secs ago
add a comment |
$begingroup$
05AB1E, 11 bytes
Uses the method from Arnauld's JS answer
.²**U.²**X‹
Try it online!
2F.²**ˆ}¯`›
also works at the same byte count
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
15 mins ago
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
13 mins ago
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
13 mins ago
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
12 mins ago
$begingroup$
Yes, sorry. That is what I meant.
$endgroup$
– Anush
23 secs ago
add a comment |
$begingroup$
05AB1E, 11 bytes
Uses the method from Arnauld's JS answer
.²**U.²**X‹
Try it online!
2F.²**ˆ}¯`›
also works at the same byte count
$endgroup$
05AB1E, 11 bytes
Uses the method from Arnauld's JS answer
.²**U.²**X‹
Try it online!
2F.²**ˆ}¯`›
also works at the same byte count
edited 2 mins ago
answered 18 mins ago
EmignaEmigna
48.3k434147
48.3k434147
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
15 mins ago
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
13 mins ago
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
13 mins ago
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
12 mins ago
$begingroup$
Yes, sorry. That is what I meant.
$endgroup$
– Anush
23 secs ago
add a comment |
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
15 mins ago
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
13 mins ago
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
13 mins ago
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
12 mins ago
$begingroup$
Yes, sorry. That is what I meant.
$endgroup$
– Anush
23 secs ago
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
15 mins ago
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
15 mins ago
1
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
13 mins ago
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
13 mins ago
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
13 mins ago
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
13 mins ago
$begingroup$
@Anush: Ah, you meant
b1=b2=b3=20
,yeah that doesn't terminate.$endgroup$
– Emigna
12 mins ago
$begingroup$
@Anush: Ah, you meant
b1=b2=b3=20
,yeah that doesn't terminate.$endgroup$
– Emigna
12 mins ago
$begingroup$
Yes, sorry. That is what I meant.
$endgroup$
– Anush
23 secs ago
$begingroup$
Yes, sorry. That is what I meant.
$endgroup$
– Anush
23 secs ago
add a comment |
$begingroup$
05AB1E, 11 bytes
2F.²**ˆ}¯`›
Input as six separated inputs.
Try it online.
Or alternatively:
εεN_i.²]P`›
Input as [[a1,a2,a3],[b1,b2,b3]]
.
Try it online.
$endgroup$
add a comment |
$begingroup$
05AB1E, 11 bytes
2F.²**ˆ}¯`›
Input as six separated inputs.
Try it online.
Or alternatively:
εεN_i.²]P`›
Input as [[a1,a2,a3],[b1,b2,b3]]
.
Try it online.
$endgroup$
add a comment |
$begingroup$
05AB1E, 11 bytes
2F.²**ˆ}¯`›
Input as six separated inputs.
Try it online.
Or alternatively:
εεN_i.²]P`›
Input as [[a1,a2,a3],[b1,b2,b3]]
.
Try it online.
$endgroup$
05AB1E, 11 bytes
2F.²**ˆ}¯`›
Input as six separated inputs.
Try it online.
Or alternatively:
εεN_i.²]P`›
Input as [[a1,a2,a3],[b1,b2,b3]]
.
Try it online.
answered 28 secs ago
Kevin CruijssenKevin Cruijssen
43.5k573222
43.5k573222
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).
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%2f184734%2fwhich-big-number-is-bigger%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
1
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to
1
and0
$endgroup$
– Unrelated String
21 mins ago
1
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
20 mins ago
$begingroup$
@KevinCruijssen No. They have to be in the order given.
$endgroup$
– Anush
17 mins ago
1
$begingroup$
Suggested test case to make sure that all solutions can support high values:
20^(20^20) > 19^(20^20)
.$endgroup$
– Arnauld
5 mins ago
$begingroup$
Suggested test case: where
a1,a2,a3
are equal tob1,b2,b3
, which should result in falsey.$endgroup$
– Kevin Cruijssen
4 mins ago