Which big number is bigger?Which really big number is bigger?Interpret whatfuckPick a random number between 0...
"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?
"The cow" OR "a cow" OR "cows" in this context
Phrase for the opposite of "foolproof"
Betweenness centrality formula
Don’t seats that recline flat defeat the purpose of having seatbelts?
Why must Chinese maps be obfuscated?
Critique of timeline aesthetic
How to stop co-workers from teasing me because I know Russian?
Does a large simulator bay have standard public address announcements?
Is there a way to generate a list of distinct numbers such that no two subsets ever have an equal sum?
Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?
As an international instructor, should I openly talk about my accent?
Rivers without rain
What term is being referred to with "reflected-sound-of-underground-spirits"?
What are the steps to solving this definite integral?
How can I practically buy stocks?
Can we say “you can pay when the order gets ready”?
Can SQL Server create collisions in system generated constraint names?
a sore throat vs a strep throat vs strep throat
Why do games have consumables?
What is causing the white spot to appear in some of my pictures
How come there are so many candidates for the 2020 Democratic party presidential nomination?
Check if a string is entirely made of the same substring
Do I have an "anti-research" personality?
Which big number is bigger?
Which really big number is bigger?Interpret whatfuckPick a random number between 0 and n using a constant source of randomnessIs this number a factorial?Square root a numberDo the circles intersect?Implement the iOS 11 CalculatorIs it a substring of itself?Gerrymandering with Logic GatesCheck if a string is entirely made of the same substringWhich really 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.
You can assume any input order you like as long as its specified in the answer and always the same.
For this question your code should always be correct. That is it should not fail because of floating point inaccuracies. Due to the limited range of the input this should not be too hard to achieve.
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) == 20^(20^20)
2^2^20 > 2^20^2
2^3^12 == 8^3^11
1^20^20 == 1^1^1
1^1^1 == 1^20^20
code-golf
$endgroup$
|
show 21 more comments
$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.
You can assume any input order you like as long as its specified in the answer and always the same.
For this question your code should always be correct. That is it should not fail because of floating point inaccuracies. Due to the limited range of the input this should not be too hard to achieve.
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) == 20^(20^20)
2^2^20 > 2^20^2
2^3^12 == 8^3^11
1^20^20 == 1^1^1
1^1^1 == 1^20^20
code-golf
$endgroup$
6
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to1
and0
$endgroup$
– Unrelated String
yesterday
2
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
yesterday
7
$begingroup$
@Anush Imposing a specific order of inputs it not common at all. You should specify that very clearly in the text. By default imput order and format are flexible
$endgroup$
– Luis Mendo
yesterday
3
$begingroup$
@Anush The question cannot always be correct. If floating-point limitations are not allowed, the code will have to use integers, or big integers, or symbolic math. Each of those eventually fail (due to data-type or memory limitations) for big enough inputs
$endgroup$
– Luis Mendo
yesterday
7
$begingroup$
Suggested test case:2^3^12 == 8^3^11
. Evil grin. This is smaller than I'd like, but I couldn't find a bigger one where floating point error matters.
$endgroup$
– Ørjan Johansen
23 hours ago
|
show 21 more comments
$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.
You can assume any input order you like as long as its specified in the answer and always the same.
For this question your code should always be correct. That is it should not fail because of floating point inaccuracies. Due to the limited range of the input this should not be too hard to achieve.
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) == 20^(20^20)
2^2^20 > 2^20^2
2^3^12 == 8^3^11
1^20^20 == 1^1^1
1^1^1 == 1^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.
You can assume any input order you like as long as its specified in the answer and always the same.
For this question your code should always be correct. That is it should not fail because of floating point inaccuracies. Due to the limited range of the input this should not be too hard to achieve.
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) == 20^(20^20)
2^2^20 > 2^20^2
2^3^12 == 8^3^11
1^20^20 == 1^1^1
1^1^1 == 1^20^20
code-golf
code-golf
edited 16 hours ago
Anush
asked yesterday
AnushAnush
939829
939829
6
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to1
and0
$endgroup$
– Unrelated String
yesterday
2
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
yesterday
7
$begingroup$
@Anush Imposing a specific order of inputs it not common at all. You should specify that very clearly in the text. By default imput order and format are flexible
$endgroup$
– Luis Mendo
yesterday
3
$begingroup$
@Anush The question cannot always be correct. If floating-point limitations are not allowed, the code will have to use integers, or big integers, or symbolic math. Each of those eventually fail (due to data-type or memory limitations) for big enough inputs
$endgroup$
– Luis Mendo
yesterday
7
$begingroup$
Suggested test case:2^3^12 == 8^3^11
. Evil grin. This is smaller than I'd like, but I couldn't find a bigger one where floating point error matters.
$endgroup$
– Ørjan Johansen
23 hours ago
|
show 21 more comments
6
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to1
and0
$endgroup$
– Unrelated String
yesterday
2
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
yesterday
7
$begingroup$
@Anush Imposing a specific order of inputs it not common at all. You should specify that very clearly in the text. By default imput order and format are flexible
$endgroup$
– Luis Mendo
yesterday
3
$begingroup$
@Anush The question cannot always be correct. If floating-point limitations are not allowed, the code will have to use integers, or big integers, or symbolic math. Each of those eventually fail (due to data-type or memory limitations) for big enough inputs
$endgroup$
– Luis Mendo
yesterday
7
$begingroup$
Suggested test case:2^3^12 == 8^3^11
. Evil grin. This is smaller than I'd like, but I couldn't find a bigger one where floating point error matters.
$endgroup$
– Ørjan Johansen
23 hours ago
6
6
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to
1
and 0
$endgroup$
– Unrelated String
yesterday
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to
1
and 0
$endgroup$
– Unrelated String
yesterday
2
2
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
yesterday
7
7
$begingroup$
@Anush Imposing a specific order of inputs it not common at all. You should specify that very clearly in the text. By default imput order and format are flexible
$endgroup$
– Luis Mendo
yesterday
$begingroup$
@Anush Imposing a specific order of inputs it not common at all. You should specify that very clearly in the text. By default imput order and format are flexible
$endgroup$
– Luis Mendo
yesterday
3
3
$begingroup$
@Anush The question cannot always be correct. If floating-point limitations are not allowed, the code will have to use integers, or big integers, or symbolic math. Each of those eventually fail (due to data-type or memory limitations) for big enough inputs
$endgroup$
– Luis Mendo
yesterday
$begingroup$
@Anush The question cannot always be correct. If floating-point limitations are not allowed, the code will have to use integers, or big integers, or symbolic math. Each of those eventually fail (due to data-type or memory limitations) for big enough inputs
$endgroup$
– Luis Mendo
yesterday
7
7
$begingroup$
Suggested test case:
2^3^12 == 8^3^11
. Evil grin. This is smaller than I'd like, but I couldn't find a bigger one where floating point error matters.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
Suggested test case:
2^3^12 == 8^3^11
. Evil grin. This is smaller than I'd like, but I couldn't find a bigger one where floating point error matters.$endgroup$
– Ørjan Johansen
23 hours ago
|
show 21 more comments
15 Answers
15
active
oldest
votes
$begingroup$
Perl 6, 31 29 bytes
-2 bytes thanks to Grimy
*.log10* * ***>*.log10* * ***
Try it online!
Believe it or not, this is not an esolang, even if it is composed of mostly asterisks. This uses Arnauld's formula, with log10 instead of ln.
$endgroup$
$begingroup$
@Anush, it looked like the footer is taking care of that
$endgroup$
– Shaggy
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen This should be fixed now. let me know if it fails for anything else
$endgroup$
– Jo King
22 hours ago
$begingroup$
-2 by removing the unneeded spaces
$endgroup$
– Grimy
8 hours ago
$begingroup$
@Grimy Thanks! I could have sworn I tried that...
$endgroup$
– Jo King
8 hours ago
add a comment |
$begingroup$
R, 39 bytes
function(x,y,z)rank(log2(x)*(y^z))[1]<2
Try it online!
Returns FALSE when a > b
and TRUE if b < a
$endgroup$
4
$begingroup$
This is wrong forf(2,2,20,2,20,2)
$endgroup$
– H.PWiz
yesterday
$begingroup$
Fixed, using your suggestion to @Arnauld answer ;)
$endgroup$
– digEmAll
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
1
$begingroup$
Fails for both1^20^20 == 1^1^1
and1^1^1 == 1^20^20
.
$endgroup$
– Olivier Grégoire
17 hours ago
add a comment |
$begingroup$
05AB1E, 11 9 11 7 bytes
.²Šm*`›
Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments
Input as [a1,b1]
, [a3,b3]
, [a2,b2]
as three separated inputs.
Try it online or verify all test cases.
Explanation:
.² # Take the logarithm with base 2 of the implicit [a1,b1]-input
Š # Triple-swap a,b,c to c,a,b with the implicit inputs
# The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
m # Take the power, resulting in [a2**a3,b2**b3]
* # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
` # Push both values separated to the stack
› # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
# (after which the result is output implicitly)
$endgroup$
1
$begingroup$
You second version can be εć.²š]P`›
$endgroup$
– Emigna
yesterday
$begingroup$
@Emigna Ah nice, I was looking at an approach withć
, but completely forgot about usingš
(not sure why now that I see it, haha). Thanks!
$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
This seems to be incorrect (because Arnauld's answer was incorrect until the recent fix).
$endgroup$
– Anush
yesterday
$begingroup$
@Anush Fixed and 4 bytes saved by taking the inputs in a different order now. :)
$endgroup$
– Kevin Cruijssen
yesterday
add a comment |
$begingroup$
Java (JDK), 56 bytes
(a,b,c,d,e,f)->a>Math.pow(d,Math.pow(e,f)/Math.pow(b,c))
Try it online!
Credits
@Ørjan Johansen for finding a bug in my solution.- Saved 10 bytes by reusing @tsh's advantageous operands agencing.
$endgroup$
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed
$endgroup$
– Olivier Grégoire
18 hours ago
add a comment |
$begingroup$
Wolfram Language (Mathematica), 23 bytes
#2^#3Log@#>#5^#6Log@#4&
Try it online!
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
@Anush fixed...
$endgroup$
– J42161217
yesterday
1
$begingroup$
Too bad about overflow, otherwise##>0&@@(##^1&@@@#)&
is only 19 bytes and even more mind-bogglingly un-Mathematica-like than the code above. (infput format{{a,b,c},{d,e,f}}
)
$endgroup$
– Greg Martin
16 hours ago
add a comment |
$begingroup$
Clean, 44 bytes
import StdEnv
$a b c d e f=b^c/e^f>ln d/ln a
Try it online!
Uses an adaptation of Arnauld's formula.
$endgroup$
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed.
$endgroup$
– Οurous
22 hours ago
add a comment |
$begingroup$
Python 3, 68 bytes
lambda a,b,c,d,e,f:log(a,2)*(b**c)>log(d,2)*(e**f)
from math import*
Try it online!
Port of @Arnualds answer, but with the base for log changed.
$endgroup$
$begingroup$
^
is called**
in Python. And with that changed, you won't be able to run all the OP's test cases.
$endgroup$
– Ørjan Johansen
yesterday
$begingroup$
Should be all fixed now, 66 bytes though.
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen should be fixed
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
Seems like it. Apart from the logarithmic base change for the fix, this looks like Arnauld's method.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 2 more comments
$begingroup$
05AB1E, 13 bytes
Uses the method from Arnauld's JS answer
2F.²IIm*ˆ}¯`›
Try it online!
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
yesterday
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
yesterday
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
yesterday
1
$begingroup$
@Anush: It is fixed now. Thanks for pointing out my mistake :)
$endgroup$
– Emigna
yesterday
|
show 5 more comments
$begingroup$
Excel, 28 bytes
=B1^C1*LOG(A1)>E1^F1*LOG(D1)
Excel implementation of the same formula already used.
$endgroup$
$begingroup$
My understanding is that Excel has 15 digits of precision, so there may be cases where rounding result in this returning the wrong answer.
$endgroup$
– Acccumulation
yesterday
add a comment |
$begingroup$
J, 11 9 bytes
>&(^.@^/)
Try it online!
Arguments given as lists.
>
is the left one bigger?
&(...)
but first, transform each argument thusly:
^.@^/
reduce it from the right to the left with exponention. But because ordinary exponentiation will limit error even for extended numbers, we take the logs of both sides
$endgroup$
add a comment |
$begingroup$
TI-BASIC, 27 31 bytes
ln(Ans(1))Ans(2)^Ans(3)>Ans(5)^Ans(6)(ln(Ans(4
Input is a list of length $6$ in Ans
.
Outputs true if the first big number is greater than the second big number. Outputs false otherwise.
Examples:
{3,4,5,5,4,3
{3 4 5 5 4 3}
prgmCDGF16
1
{20,20,20,20,20,19 ;these two lines go off-screen
{20 20 20 20 20 19}
prgmCDGF16
1
{3,6,5,5,20,3
{3 6 5 5 20 3}
prgmCDGF16
0
Explanation:
ln(Ans(2))ln(Ans(1))Ans(3)>Ans(6)ln(Ans(5))ln(Ans(4 ;full program
;elements of input denoted as:
; {#1 #2 #3 #4 #5 #6}
ln(Ans(2))ln(Ans(1))Ans(3) ;calculate #3*ln(#2)*ln(#1)
Ans(6)ln(Ans(5))ln(Ans(4 ;calculate #6*ln(#5)*ln(#4)
> ;is the first result greater than the
; second result?
; leave answer in "Ans"
;implicit print of "Ans"
Note: TI-BASIC is a tokenized language. Character count does not equal byte count.
$endgroup$
$begingroup$
I’m not that familiar with TI-BASIC, but this seems to belog(x) × y × z
rather thanlog(x) × y ^ z
. This won’t necessarily lead to the same ordering as the original inequality.
$endgroup$
– Nick Kennedy
yesterday
$begingroup$
@NickKennedy Yes, you are correct about that! I'll update the post to account for this.
$endgroup$
– Tau
yesterday
add a comment |
$begingroup$
bc -l, 47 bytes
l(read())*read()^read()>l(read())*read()^read()
with the input read from STDIN
, one integer per line.
bc
is pretty fast; it handles a=b=c=d=e=f=1,000,000 in a little over a second on my laptop.
$endgroup$
$begingroup$
I love a bc answer! Just need one in bash now :)
$endgroup$
– Anush
19 hours ago
add a comment |
$begingroup$
CJam, 11 bytes
{##@@#@#<}
Try it online!
Explanation:
{ }
Marks a code-block, or a function. Let's say the parameters are a1, a2, a3, b1, b2, b3.
##
Does power twice => a1, a2, a3, b1^(b2^b3)
@@
Rotates stack twice => a1, b1^(b2^b3), a2, a3
#
Power => a1, b1^(b2^b3), a2^a3
@
Rotate and swap top two stack elements => b1^(b2^b3), a1, a2^a3
#
Power => b1^(b2^b3), a1^(a2^a3)
<
Since we now have the two arguments for >
the wrong way round, we use <
instead. There is implicit output at the end.
$endgroup$
$begingroup$
This can’t really be computing 20^20^20 for example, can it? That would be too large.
$endgroup$
– Anush
18 hours ago
1
$begingroup$
This doesn't handle extremely large numbers correctly. For example, 20^20^10 errors in an integer overflow
$endgroup$
– Jo King
9 hours ago
add a comment |
$begingroup$
C++ (gcc), 86 bytes
Thanks to @ØrjanJohansen for pointing out a flaw in this and @Ourous for giving a fix.
#import<cmath>
int a(int i[]){return pow(i[1],i[2])/pow(i[4],i[5])>log(i[3])/log(*i);}
Try it online!
Takes input as a 6-integer array. Returns 1 if $a^{b^c} > d^{e^f}$, 0 otherwise.
$endgroup$
$begingroup$
The formula after takinglog
twice should bei[2]*log(i[1])+log(log(*i))
. E.g. the current one will fail for2^2^20 > 4^2^18
.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: good catch! I guess I have to use thepow
method then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
The alternate one has the2^3^12 == 8^3^11
problem I've pointed out for others.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: well, I guess I'm using your fixed formula then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
Oh, I'm afraid that formula is only mathematically correct. It still has a floating point error problem, just with a different case,2^3^20 == 8^3^19
. In fact on average the power method fails for fewer, probably because it tends to multiply by powers of two exactly. Others have managed to make it work by just tweaking it slightly.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 3 more comments
$begingroup$
Jelly, 8 bytes
l⁵×*/}>/
Try it online!
Based on Arnauld’s JS answer. Expects as input [a1, b1]
as left argument and [[a2, b2], [a3, b3]]
as right argument.
Now changed to use log to the base 10 which as far as correctly handles all the possible inputs in the range specified. Thanks to Ørjan Johansen for finding the original problem!
$endgroup$
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
Your Python TIO is incorrect.. You have8*
instead of8**
. @ØrjanJohansen is indeed correct that2**(3**12) > 8**(3**11)
is falsey, since they are equal.
$endgroup$
– Kevin Cruijssen
17 hours ago
$begingroup$
@KevinCruijssen oops. Yes they are indeed equal. The reason the original two are marked as different relates to floating point error.
$endgroup$
– Nick Kennedy
17 hours ago
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
15 Answers
15
active
oldest
votes
15 Answers
15
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Perl 6, 31 29 bytes
-2 bytes thanks to Grimy
*.log10* * ***>*.log10* * ***
Try it online!
Believe it or not, this is not an esolang, even if it is composed of mostly asterisks. This uses Arnauld's formula, with log10 instead of ln.
$endgroup$
$begingroup$
@Anush, it looked like the footer is taking care of that
$endgroup$
– Shaggy
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen This should be fixed now. let me know if it fails for anything else
$endgroup$
– Jo King
22 hours ago
$begingroup$
-2 by removing the unneeded spaces
$endgroup$
– Grimy
8 hours ago
$begingroup$
@Grimy Thanks! I could have sworn I tried that...
$endgroup$
– Jo King
8 hours ago
add a comment |
$begingroup$
Perl 6, 31 29 bytes
-2 bytes thanks to Grimy
*.log10* * ***>*.log10* * ***
Try it online!
Believe it or not, this is not an esolang, even if it is composed of mostly asterisks. This uses Arnauld's formula, with log10 instead of ln.
$endgroup$
$begingroup$
@Anush, it looked like the footer is taking care of that
$endgroup$
– Shaggy
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen This should be fixed now. let me know if it fails for anything else
$endgroup$
– Jo King
22 hours ago
$begingroup$
-2 by removing the unneeded spaces
$endgroup$
– Grimy
8 hours ago
$begingroup$
@Grimy Thanks! I could have sworn I tried that...
$endgroup$
– Jo King
8 hours ago
add a comment |
$begingroup$
Perl 6, 31 29 bytes
-2 bytes thanks to Grimy
*.log10* * ***>*.log10* * ***
Try it online!
Believe it or not, this is not an esolang, even if it is composed of mostly asterisks. This uses Arnauld's formula, with log10 instead of ln.
$endgroup$
Perl 6, 31 29 bytes
-2 bytes thanks to Grimy
*.log10* * ***>*.log10* * ***
Try it online!
Believe it or not, this is not an esolang, even if it is composed of mostly asterisks. This uses Arnauld's formula, with log10 instead of ln.
edited 8 hours ago
answered yesterday
Jo KingJo King
27.7k366134
27.7k366134
$begingroup$
@Anush, it looked like the footer is taking care of that
$endgroup$
– Shaggy
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen This should be fixed now. let me know if it fails for anything else
$endgroup$
– Jo King
22 hours ago
$begingroup$
-2 by removing the unneeded spaces
$endgroup$
– Grimy
8 hours ago
$begingroup$
@Grimy Thanks! I could have sworn I tried that...
$endgroup$
– Jo King
8 hours ago
add a comment |
$begingroup$
@Anush, it looked like the footer is taking care of that
$endgroup$
– Shaggy
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen This should be fixed now. let me know if it fails for anything else
$endgroup$
– Jo King
22 hours ago
$begingroup$
-2 by removing the unneeded spaces
$endgroup$
– Grimy
8 hours ago
$begingroup$
@Grimy Thanks! I could have sworn I tried that...
$endgroup$
– Jo King
8 hours ago
$begingroup$
@Anush, it looked like the footer is taking care of that
$endgroup$
– Shaggy
yesterday
$begingroup$
@Anush, it looked like the footer is taking care of that
$endgroup$
– Shaggy
yesterday
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen This should be fixed now. let me know if it fails for anything else
$endgroup$
– Jo King
22 hours ago
$begingroup$
@ØrjanJohansen This should be fixed now. let me know if it fails for anything else
$endgroup$
– Jo King
22 hours ago
$begingroup$
-2 by removing the unneeded spaces
$endgroup$
– Grimy
8 hours ago
$begingroup$
-2 by removing the unneeded spaces
$endgroup$
– Grimy
8 hours ago
$begingroup$
@Grimy Thanks! I could have sworn I tried that...
$endgroup$
– Jo King
8 hours ago
$begingroup$
@Grimy Thanks! I could have sworn I tried that...
$endgroup$
– Jo King
8 hours ago
add a comment |
$begingroup$
R, 39 bytes
function(x,y,z)rank(log2(x)*(y^z))[1]<2
Try it online!
Returns FALSE when a > b
and TRUE if b < a
$endgroup$
4
$begingroup$
This is wrong forf(2,2,20,2,20,2)
$endgroup$
– H.PWiz
yesterday
$begingroup$
Fixed, using your suggestion to @Arnauld answer ;)
$endgroup$
– digEmAll
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
1
$begingroup$
Fails for both1^20^20 == 1^1^1
and1^1^1 == 1^20^20
.
$endgroup$
– Olivier Grégoire
17 hours ago
add a comment |
$begingroup$
R, 39 bytes
function(x,y,z)rank(log2(x)*(y^z))[1]<2
Try it online!
Returns FALSE when a > b
and TRUE if b < a
$endgroup$
4
$begingroup$
This is wrong forf(2,2,20,2,20,2)
$endgroup$
– H.PWiz
yesterday
$begingroup$
Fixed, using your suggestion to @Arnauld answer ;)
$endgroup$
– digEmAll
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
1
$begingroup$
Fails for both1^20^20 == 1^1^1
and1^1^1 == 1^20^20
.
$endgroup$
– Olivier Grégoire
17 hours ago
add a comment |
$begingroup$
R, 39 bytes
function(x,y,z)rank(log2(x)*(y^z))[1]<2
Try it online!
Returns FALSE when a > b
and TRUE if b < a
$endgroup$
R, 39 bytes
function(x,y,z)rank(log2(x)*(y^z))[1]<2
Try it online!
Returns FALSE when a > b
and TRUE if b < a
edited 11 hours ago
answered yesterday
digEmAlldigEmAll
3,714516
3,714516
4
$begingroup$
This is wrong forf(2,2,20,2,20,2)
$endgroup$
– H.PWiz
yesterday
$begingroup$
Fixed, using your suggestion to @Arnauld answer ;)
$endgroup$
– digEmAll
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
1
$begingroup$
Fails for both1^20^20 == 1^1^1
and1^1^1 == 1^20^20
.
$endgroup$
– Olivier Grégoire
17 hours ago
add a comment |
4
$begingroup$
This is wrong forf(2,2,20,2,20,2)
$endgroup$
– H.PWiz
yesterday
$begingroup$
Fixed, using your suggestion to @Arnauld answer ;)
$endgroup$
– digEmAll
yesterday
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
1
$begingroup$
Fails for both1^20^20 == 1^1^1
and1^1^1 == 1^20^20
.
$endgroup$
– Olivier Grégoire
17 hours ago
4
4
$begingroup$
This is wrong for
f(2,2,20,2,20,2)
$endgroup$
– H.PWiz
yesterday
$begingroup$
This is wrong for
f(2,2,20,2,20,2)
$endgroup$
– H.PWiz
yesterday
$begingroup$
Fixed, using your suggestion to @Arnauld answer ;)
$endgroup$
– digEmAll
yesterday
$begingroup$
Fixed, using your suggestion to @Arnauld answer ;)
$endgroup$
– digEmAll
yesterday
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
1
1
$begingroup$
Fails for both
1^20^20 == 1^1^1
and 1^1^1 == 1^20^20
.$endgroup$
– Olivier Grégoire
17 hours ago
$begingroup$
Fails for both
1^20^20 == 1^1^1
and 1^1^1 == 1^20^20
.$endgroup$
– Olivier Grégoire
17 hours ago
add a comment |
$begingroup$
05AB1E, 11 9 11 7 bytes
.²Šm*`›
Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments
Input as [a1,b1]
, [a3,b3]
, [a2,b2]
as three separated inputs.
Try it online or verify all test cases.
Explanation:
.² # Take the logarithm with base 2 of the implicit [a1,b1]-input
Š # Triple-swap a,b,c to c,a,b with the implicit inputs
# The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
m # Take the power, resulting in [a2**a3,b2**b3]
* # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
` # Push both values separated to the stack
› # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
# (after which the result is output implicitly)
$endgroup$
1
$begingroup$
You second version can be εć.²š]P`›
$endgroup$
– Emigna
yesterday
$begingroup$
@Emigna Ah nice, I was looking at an approach withć
, but completely forgot about usingš
(not sure why now that I see it, haha). Thanks!
$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
This seems to be incorrect (because Arnauld's answer was incorrect until the recent fix).
$endgroup$
– Anush
yesterday
$begingroup$
@Anush Fixed and 4 bytes saved by taking the inputs in a different order now. :)
$endgroup$
– Kevin Cruijssen
yesterday
add a comment |
$begingroup$
05AB1E, 11 9 11 7 bytes
.²Šm*`›
Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments
Input as [a1,b1]
, [a3,b3]
, [a2,b2]
as three separated inputs.
Try it online or verify all test cases.
Explanation:
.² # Take the logarithm with base 2 of the implicit [a1,b1]-input
Š # Triple-swap a,b,c to c,a,b with the implicit inputs
# The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
m # Take the power, resulting in [a2**a3,b2**b3]
* # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
` # Push both values separated to the stack
› # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
# (after which the result is output implicitly)
$endgroup$
1
$begingroup$
You second version can be εć.²š]P`›
$endgroup$
– Emigna
yesterday
$begingroup$
@Emigna Ah nice, I was looking at an approach withć
, but completely forgot about usingš
(not sure why now that I see it, haha). Thanks!
$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
This seems to be incorrect (because Arnauld's answer was incorrect until the recent fix).
$endgroup$
– Anush
yesterday
$begingroup$
@Anush Fixed and 4 bytes saved by taking the inputs in a different order now. :)
$endgroup$
– Kevin Cruijssen
yesterday
add a comment |
$begingroup$
05AB1E, 11 9 11 7 bytes
.²Šm*`›
Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments
Input as [a1,b1]
, [a3,b3]
, [a2,b2]
as three separated inputs.
Try it online or verify all test cases.
Explanation:
.² # Take the logarithm with base 2 of the implicit [a1,b1]-input
Š # Triple-swap a,b,c to c,a,b with the implicit inputs
# The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
m # Take the power, resulting in [a2**a3,b2**b3]
* # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
` # Push both values separated to the stack
› # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
# (after which the result is output implicitly)
$endgroup$
05AB1E, 11 9 11 7 bytes
.²Šm*`›
Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments
Input as [a1,b1]
, [a3,b3]
, [a2,b2]
as three separated inputs.
Try it online or verify all test cases.
Explanation:
.² # Take the logarithm with base 2 of the implicit [a1,b1]-input
Š # Triple-swap a,b,c to c,a,b with the implicit inputs
# The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
m # Take the power, resulting in [a2**a3,b2**b3]
* # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
` # Push both values separated to the stack
› # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
# (after which the result is output implicitly)
edited 17 hours ago
answered yesterday
Kevin CruijssenKevin Cruijssen
43.7k573222
43.7k573222
1
$begingroup$
You second version can be εć.²š]P`›
$endgroup$
– Emigna
yesterday
$begingroup$
@Emigna Ah nice, I was looking at an approach withć
, but completely forgot about usingš
(not sure why now that I see it, haha). Thanks!
$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
This seems to be incorrect (because Arnauld's answer was incorrect until the recent fix).
$endgroup$
– Anush
yesterday
$begingroup$
@Anush Fixed and 4 bytes saved by taking the inputs in a different order now. :)
$endgroup$
– Kevin Cruijssen
yesterday
add a comment |
1
$begingroup$
You second version can be εć.²š]P`›
$endgroup$
– Emigna
yesterday
$begingroup$
@Emigna Ah nice, I was looking at an approach withć
, but completely forgot about usingš
(not sure why now that I see it, haha). Thanks!
$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
This seems to be incorrect (because Arnauld's answer was incorrect until the recent fix).
$endgroup$
– Anush
yesterday
$begingroup$
@Anush Fixed and 4 bytes saved by taking the inputs in a different order now. :)
$endgroup$
– Kevin Cruijssen
yesterday
1
1
$begingroup$
You second version can be εć.²š]P`›
$endgroup$
– Emigna
yesterday
$begingroup$
You second version can be εć.²š]P`›
$endgroup$
– Emigna
yesterday
$begingroup$
@Emigna Ah nice, I was looking at an approach with
ć
, but completely forgot about using š
(not sure why now that I see it, haha). Thanks!$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
@Emigna Ah nice, I was looking at an approach with
ć
, but completely forgot about using š
(not sure why now that I see it, haha). Thanks!$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
This seems to be incorrect (because Arnauld's answer was incorrect until the recent fix).
$endgroup$
– Anush
yesterday
$begingroup$
This seems to be incorrect (because Arnauld's answer was incorrect until the recent fix).
$endgroup$
– Anush
yesterday
$begingroup$
@Anush Fixed and 4 bytes saved by taking the inputs in a different order now. :)
$endgroup$
– Kevin Cruijssen
yesterday
$begingroup$
@Anush Fixed and 4 bytes saved by taking the inputs in a different order now. :)
$endgroup$
– Kevin Cruijssen
yesterday
add a comment |
$begingroup$
Java (JDK), 56 bytes
(a,b,c,d,e,f)->a>Math.pow(d,Math.pow(e,f)/Math.pow(b,c))
Try it online!
Credits
@Ørjan Johansen for finding a bug in my solution.- Saved 10 bytes by reusing @tsh's advantageous operands agencing.
$endgroup$
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed
$endgroup$
– Olivier Grégoire
18 hours ago
add a comment |
$begingroup$
Java (JDK), 56 bytes
(a,b,c,d,e,f)->a>Math.pow(d,Math.pow(e,f)/Math.pow(b,c))
Try it online!
Credits
@Ørjan Johansen for finding a bug in my solution.- Saved 10 bytes by reusing @tsh's advantageous operands agencing.
$endgroup$
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed
$endgroup$
– Olivier Grégoire
18 hours ago
add a comment |
$begingroup$
Java (JDK), 56 bytes
(a,b,c,d,e,f)->a>Math.pow(d,Math.pow(e,f)/Math.pow(b,c))
Try it online!
Credits
@Ørjan Johansen for finding a bug in my solution.- Saved 10 bytes by reusing @tsh's advantageous operands agencing.
$endgroup$
Java (JDK), 56 bytes
(a,b,c,d,e,f)->a>Math.pow(d,Math.pow(e,f)/Math.pow(b,c))
Try it online!
Credits
@Ørjan Johansen for finding a bug in my solution.- Saved 10 bytes by reusing @tsh's advantageous operands agencing.
edited 16 hours ago
answered yesterday
Olivier GrégoireOlivier Grégoire
9,55511944
9,55511944
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed
$endgroup$
– Olivier Grégoire
18 hours ago
add a comment |
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed
$endgroup$
– Olivier Grégoire
18 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed
$endgroup$
– Olivier Grégoire
18 hours ago
$begingroup$
@ØrjanJohansen Fixed
$endgroup$
– Olivier Grégoire
18 hours ago
add a comment |
$begingroup$
Wolfram Language (Mathematica), 23 bytes
#2^#3Log@#>#5^#6Log@#4&
Try it online!
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
@Anush fixed...
$endgroup$
– J42161217
yesterday
1
$begingroup$
Too bad about overflow, otherwise##>0&@@(##^1&@@@#)&
is only 19 bytes and even more mind-bogglingly un-Mathematica-like than the code above. (infput format{{a,b,c},{d,e,f}}
)
$endgroup$
– Greg Martin
16 hours ago
add a comment |
$begingroup$
Wolfram Language (Mathematica), 23 bytes
#2^#3Log@#>#5^#6Log@#4&
Try it online!
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
@Anush fixed...
$endgroup$
– J42161217
yesterday
1
$begingroup$
Too bad about overflow, otherwise##>0&@@(##^1&@@@#)&
is only 19 bytes and even more mind-bogglingly un-Mathematica-like than the code above. (infput format{{a,b,c},{d,e,f}}
)
$endgroup$
– Greg Martin
16 hours ago
add a comment |
$begingroup$
Wolfram Language (Mathematica), 23 bytes
#2^#3Log@#>#5^#6Log@#4&
Try it online!
$endgroup$
Wolfram Language (Mathematica), 23 bytes
#2^#3Log@#>#5^#6Log@#4&
Try it online!
edited yesterday
answered yesterday
J42161217J42161217
14.5k21354
14.5k21354
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
@Anush fixed...
$endgroup$
– J42161217
yesterday
1
$begingroup$
Too bad about overflow, otherwise##>0&@@(##^1&@@@#)&
is only 19 bytes and even more mind-bogglingly un-Mathematica-like than the code above. (infput format{{a,b,c},{d,e,f}}
)
$endgroup$
– Greg Martin
16 hours ago
add a comment |
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
@Anush fixed...
$endgroup$
– J42161217
yesterday
1
$begingroup$
Too bad about overflow, otherwise##>0&@@(##^1&@@@#)&
is only 19 bytes and even more mind-bogglingly un-Mathematica-like than the code above. (infput format{{a,b,c},{d,e,f}}
)
$endgroup$
– Greg Martin
16 hours ago
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
@Anush fixed...
$endgroup$
– J42161217
yesterday
$begingroup$
@Anush fixed...
$endgroup$
– J42161217
yesterday
1
1
$begingroup$
Too bad about overflow, otherwise
##>0&@@(##^1&@@@#)&
is only 19 bytes and even more mind-bogglingly un-Mathematica-like than the code above. (infput format {{a,b,c},{d,e,f}}
)$endgroup$
– Greg Martin
16 hours ago
$begingroup$
Too bad about overflow, otherwise
##>0&@@(##^1&@@@#)&
is only 19 bytes and even more mind-bogglingly un-Mathematica-like than the code above. (infput format {{a,b,c},{d,e,f}}
)$endgroup$
– Greg Martin
16 hours ago
add a comment |
$begingroup$
Clean, 44 bytes
import StdEnv
$a b c d e f=b^c/e^f>ln d/ln a
Try it online!
Uses an adaptation of Arnauld's formula.
$endgroup$
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed.
$endgroup$
– Οurous
22 hours ago
add a comment |
$begingroup$
Clean, 44 bytes
import StdEnv
$a b c d e f=b^c/e^f>ln d/ln a
Try it online!
Uses an adaptation of Arnauld's formula.
$endgroup$
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed.
$endgroup$
– Οurous
22 hours ago
add a comment |
$begingroup$
Clean, 44 bytes
import StdEnv
$a b c d e f=b^c/e^f>ln d/ln a
Try it online!
Uses an adaptation of Arnauld's formula.
$endgroup$
Clean, 44 bytes
import StdEnv
$a b c d e f=b^c/e^f>ln d/ln a
Try it online!
Uses an adaptation of Arnauld's formula.
edited 22 hours ago
answered 23 hours ago
ΟurousΟurous
7,47611136
7,47611136
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed.
$endgroup$
– Οurous
22 hours ago
add a comment |
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed.
$endgroup$
– Οurous
22 hours ago
1
1
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen Fixed.
$endgroup$
– Οurous
22 hours ago
$begingroup$
@ØrjanJohansen Fixed.
$endgroup$
– Οurous
22 hours ago
add a comment |
$begingroup$
Python 3, 68 bytes
lambda a,b,c,d,e,f:log(a,2)*(b**c)>log(d,2)*(e**f)
from math import*
Try it online!
Port of @Arnualds answer, but with the base for log changed.
$endgroup$
$begingroup$
^
is called**
in Python. And with that changed, you won't be able to run all the OP's test cases.
$endgroup$
– Ørjan Johansen
yesterday
$begingroup$
Should be all fixed now, 66 bytes though.
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen should be fixed
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
Seems like it. Apart from the logarithmic base change for the fix, this looks like Arnauld's method.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 2 more comments
$begingroup$
Python 3, 68 bytes
lambda a,b,c,d,e,f:log(a,2)*(b**c)>log(d,2)*(e**f)
from math import*
Try it online!
Port of @Arnualds answer, but with the base for log changed.
$endgroup$
$begingroup$
^
is called**
in Python. And with that changed, you won't be able to run all the OP's test cases.
$endgroup$
– Ørjan Johansen
yesterday
$begingroup$
Should be all fixed now, 66 bytes though.
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen should be fixed
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
Seems like it. Apart from the logarithmic base change for the fix, this looks like Arnauld's method.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 2 more comments
$begingroup$
Python 3, 68 bytes
lambda a,b,c,d,e,f:log(a,2)*(b**c)>log(d,2)*(e**f)
from math import*
Try it online!
Port of @Arnualds answer, but with the base for log changed.
$endgroup$
Python 3, 68 bytes
lambda a,b,c,d,e,f:log(a,2)*(b**c)>log(d,2)*(e**f)
from math import*
Try it online!
Port of @Arnualds answer, but with the base for log changed.
edited 16 hours ago
answered yesterday
Artemis FowlArtemis Fowl
306112
306112
$begingroup$
^
is called**
in Python. And with that changed, you won't be able to run all the OP's test cases.
$endgroup$
– Ørjan Johansen
yesterday
$begingroup$
Should be all fixed now, 66 bytes though.
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen should be fixed
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
Seems like it. Apart from the logarithmic base change for the fix, this looks like Arnauld's method.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 2 more comments
$begingroup$
^
is called**
in Python. And with that changed, you won't be able to run all the OP's test cases.
$endgroup$
– Ørjan Johansen
yesterday
$begingroup$
Should be all fixed now, 66 bytes though.
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen should be fixed
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
Seems like it. Apart from the logarithmic base change for the fix, this looks like Arnauld's method.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
^
is called **
in Python. And with that changed, you won't be able to run all the OP's test cases.$endgroup$
– Ørjan Johansen
yesterday
$begingroup$
^
is called **
in Python. And with that changed, you won't be able to run all the OP's test cases.$endgroup$
– Ørjan Johansen
yesterday
$begingroup$
Should be all fixed now, 66 bytes though.
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
Should be all fixed now, 66 bytes though.
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
@ØrjanJohansen should be fixed
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
@ØrjanJohansen should be fixed
$endgroup$
– Artemis Fowl
23 hours ago
$begingroup$
Seems like it. Apart from the logarithmic base change for the fix, this looks like Arnauld's method.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
Seems like it. Apart from the logarithmic base change for the fix, this looks like Arnauld's method.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 2 more comments
$begingroup$
05AB1E, 13 bytes
Uses the method from Arnauld's JS answer
2F.²IIm*ˆ}¯`›
Try it online!
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
yesterday
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
yesterday
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
yesterday
1
$begingroup$
@Anush: It is fixed now. Thanks for pointing out my mistake :)
$endgroup$
– Emigna
yesterday
|
show 5 more comments
$begingroup$
05AB1E, 13 bytes
Uses the method from Arnauld's JS answer
2F.²IIm*ˆ}¯`›
Try it online!
$endgroup$
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
yesterday
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
yesterday
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
yesterday
1
$begingroup$
@Anush: It is fixed now. Thanks for pointing out my mistake :)
$endgroup$
– Emigna
yesterday
|
show 5 more comments
$begingroup$
05AB1E, 13 bytes
Uses the method from Arnauld's JS answer
2F.²IIm*ˆ}¯`›
Try it online!
$endgroup$
05AB1E, 13 bytes
Uses the method from Arnauld's JS answer
2F.²IIm*ˆ}¯`›
Try it online!
edited yesterday
answered yesterday
EmignaEmigna
48.4k434147
48.4k434147
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
yesterday
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
yesterday
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
yesterday
1
$begingroup$
@Anush: It is fixed now. Thanks for pointing out my mistake :)
$endgroup$
– Emigna
yesterday
|
show 5 more comments
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
yesterday
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
yesterday
$begingroup$
@Anush: Ah, you meantb1=b2=b3=20
,yeah that doesn't terminate.
$endgroup$
– Emigna
yesterday
1
$begingroup$
@Anush: It is fixed now. Thanks for pointing out my mistake :)
$endgroup$
– Emigna
yesterday
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
$begingroup$
This doesn't terminate for a1=20, a2=20, a3=20.
$endgroup$
– Anush
yesterday
1
1
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
yesterday
$begingroup$
@Anush: Seems to terminate in less than a second to me.
$endgroup$
– Emigna
yesterday
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
yesterday
$begingroup$
you have to set all the variables to 20. See tio.run/##yy9OTMpM/f9f79Du3GK9Q6tzHzXs@v8/2shAB4xiuRBMAA
$endgroup$
– Anush
yesterday
$begingroup$
@Anush: Ah, you meant
b1=b2=b3=20
,yeah that doesn't terminate.$endgroup$
– Emigna
yesterday
$begingroup$
@Anush: Ah, you meant
b1=b2=b3=20
,yeah that doesn't terminate.$endgroup$
– Emigna
yesterday
1
1
$begingroup$
@Anush: It is fixed now. Thanks for pointing out my mistake :)
$endgroup$
– Emigna
yesterday
$begingroup$
@Anush: It is fixed now. Thanks for pointing out my mistake :)
$endgroup$
– Emigna
yesterday
|
show 5 more comments
$begingroup$
Excel, 28 bytes
=B1^C1*LOG(A1)>E1^F1*LOG(D1)
Excel implementation of the same formula already used.
$endgroup$
$begingroup$
My understanding is that Excel has 15 digits of precision, so there may be cases where rounding result in this returning the wrong answer.
$endgroup$
– Acccumulation
yesterday
add a comment |
$begingroup$
Excel, 28 bytes
=B1^C1*LOG(A1)>E1^F1*LOG(D1)
Excel implementation of the same formula already used.
$endgroup$
$begingroup$
My understanding is that Excel has 15 digits of precision, so there may be cases where rounding result in this returning the wrong answer.
$endgroup$
– Acccumulation
yesterday
add a comment |
$begingroup$
Excel, 28 bytes
=B1^C1*LOG(A1)>E1^F1*LOG(D1)
Excel implementation of the same formula already used.
$endgroup$
Excel, 28 bytes
=B1^C1*LOG(A1)>E1^F1*LOG(D1)
Excel implementation of the same formula already used.
answered yesterday
WernischWernisch
1,708317
1,708317
$begingroup$
My understanding is that Excel has 15 digits of precision, so there may be cases where rounding result in this returning the wrong answer.
$endgroup$
– Acccumulation
yesterday
add a comment |
$begingroup$
My understanding is that Excel has 15 digits of precision, so there may be cases where rounding result in this returning the wrong answer.
$endgroup$
– Acccumulation
yesterday
$begingroup$
My understanding is that Excel has 15 digits of precision, so there may be cases where rounding result in this returning the wrong answer.
$endgroup$
– Acccumulation
yesterday
$begingroup$
My understanding is that Excel has 15 digits of precision, so there may be cases where rounding result in this returning the wrong answer.
$endgroup$
– Acccumulation
yesterday
add a comment |
$begingroup$
J, 11 9 bytes
>&(^.@^/)
Try it online!
Arguments given as lists.
>
is the left one bigger?
&(...)
but first, transform each argument thusly:
^.@^/
reduce it from the right to the left with exponention. But because ordinary exponentiation will limit error even for extended numbers, we take the logs of both sides
$endgroup$
add a comment |
$begingroup$
J, 11 9 bytes
>&(^.@^/)
Try it online!
Arguments given as lists.
>
is the left one bigger?
&(...)
but first, transform each argument thusly:
^.@^/
reduce it from the right to the left with exponention. But because ordinary exponentiation will limit error even for extended numbers, we take the logs of both sides
$endgroup$
add a comment |
$begingroup$
J, 11 9 bytes
>&(^.@^/)
Try it online!
Arguments given as lists.
>
is the left one bigger?
&(...)
but first, transform each argument thusly:
^.@^/
reduce it from the right to the left with exponention. But because ordinary exponentiation will limit error even for extended numbers, we take the logs of both sides
$endgroup$
J, 11 9 bytes
>&(^.@^/)
Try it online!
Arguments given as lists.
>
is the left one bigger?
&(...)
but first, transform each argument thusly:
^.@^/
reduce it from the right to the left with exponention. But because ordinary exponentiation will limit error even for extended numbers, we take the logs of both sides
edited yesterday
answered yesterday
JonahJonah
3,0481019
3,0481019
add a comment |
add a comment |
$begingroup$
TI-BASIC, 27 31 bytes
ln(Ans(1))Ans(2)^Ans(3)>Ans(5)^Ans(6)(ln(Ans(4
Input is a list of length $6$ in Ans
.
Outputs true if the first big number is greater than the second big number. Outputs false otherwise.
Examples:
{3,4,5,5,4,3
{3 4 5 5 4 3}
prgmCDGF16
1
{20,20,20,20,20,19 ;these two lines go off-screen
{20 20 20 20 20 19}
prgmCDGF16
1
{3,6,5,5,20,3
{3 6 5 5 20 3}
prgmCDGF16
0
Explanation:
ln(Ans(2))ln(Ans(1))Ans(3)>Ans(6)ln(Ans(5))ln(Ans(4 ;full program
;elements of input denoted as:
; {#1 #2 #3 #4 #5 #6}
ln(Ans(2))ln(Ans(1))Ans(3) ;calculate #3*ln(#2)*ln(#1)
Ans(6)ln(Ans(5))ln(Ans(4 ;calculate #6*ln(#5)*ln(#4)
> ;is the first result greater than the
; second result?
; leave answer in "Ans"
;implicit print of "Ans"
Note: TI-BASIC is a tokenized language. Character count does not equal byte count.
$endgroup$
$begingroup$
I’m not that familiar with TI-BASIC, but this seems to belog(x) × y × z
rather thanlog(x) × y ^ z
. This won’t necessarily lead to the same ordering as the original inequality.
$endgroup$
– Nick Kennedy
yesterday
$begingroup$
@NickKennedy Yes, you are correct about that! I'll update the post to account for this.
$endgroup$
– Tau
yesterday
add a comment |
$begingroup$
TI-BASIC, 27 31 bytes
ln(Ans(1))Ans(2)^Ans(3)>Ans(5)^Ans(6)(ln(Ans(4
Input is a list of length $6$ in Ans
.
Outputs true if the first big number is greater than the second big number. Outputs false otherwise.
Examples:
{3,4,5,5,4,3
{3 4 5 5 4 3}
prgmCDGF16
1
{20,20,20,20,20,19 ;these two lines go off-screen
{20 20 20 20 20 19}
prgmCDGF16
1
{3,6,5,5,20,3
{3 6 5 5 20 3}
prgmCDGF16
0
Explanation:
ln(Ans(2))ln(Ans(1))Ans(3)>Ans(6)ln(Ans(5))ln(Ans(4 ;full program
;elements of input denoted as:
; {#1 #2 #3 #4 #5 #6}
ln(Ans(2))ln(Ans(1))Ans(3) ;calculate #3*ln(#2)*ln(#1)
Ans(6)ln(Ans(5))ln(Ans(4 ;calculate #6*ln(#5)*ln(#4)
> ;is the first result greater than the
; second result?
; leave answer in "Ans"
;implicit print of "Ans"
Note: TI-BASIC is a tokenized language. Character count does not equal byte count.
$endgroup$
$begingroup$
I’m not that familiar with TI-BASIC, but this seems to belog(x) × y × z
rather thanlog(x) × y ^ z
. This won’t necessarily lead to the same ordering as the original inequality.
$endgroup$
– Nick Kennedy
yesterday
$begingroup$
@NickKennedy Yes, you are correct about that! I'll update the post to account for this.
$endgroup$
– Tau
yesterday
add a comment |
$begingroup$
TI-BASIC, 27 31 bytes
ln(Ans(1))Ans(2)^Ans(3)>Ans(5)^Ans(6)(ln(Ans(4
Input is a list of length $6$ in Ans
.
Outputs true if the first big number is greater than the second big number. Outputs false otherwise.
Examples:
{3,4,5,5,4,3
{3 4 5 5 4 3}
prgmCDGF16
1
{20,20,20,20,20,19 ;these two lines go off-screen
{20 20 20 20 20 19}
prgmCDGF16
1
{3,6,5,5,20,3
{3 6 5 5 20 3}
prgmCDGF16
0
Explanation:
ln(Ans(2))ln(Ans(1))Ans(3)>Ans(6)ln(Ans(5))ln(Ans(4 ;full program
;elements of input denoted as:
; {#1 #2 #3 #4 #5 #6}
ln(Ans(2))ln(Ans(1))Ans(3) ;calculate #3*ln(#2)*ln(#1)
Ans(6)ln(Ans(5))ln(Ans(4 ;calculate #6*ln(#5)*ln(#4)
> ;is the first result greater than the
; second result?
; leave answer in "Ans"
;implicit print of "Ans"
Note: TI-BASIC is a tokenized language. Character count does not equal byte count.
$endgroup$
TI-BASIC, 27 31 bytes
ln(Ans(1))Ans(2)^Ans(3)>Ans(5)^Ans(6)(ln(Ans(4
Input is a list of length $6$ in Ans
.
Outputs true if the first big number is greater than the second big number. Outputs false otherwise.
Examples:
{3,4,5,5,4,3
{3 4 5 5 4 3}
prgmCDGF16
1
{20,20,20,20,20,19 ;these two lines go off-screen
{20 20 20 20 20 19}
prgmCDGF16
1
{3,6,5,5,20,3
{3 6 5 5 20 3}
prgmCDGF16
0
Explanation:
ln(Ans(2))ln(Ans(1))Ans(3)>Ans(6)ln(Ans(5))ln(Ans(4 ;full program
;elements of input denoted as:
; {#1 #2 #3 #4 #5 #6}
ln(Ans(2))ln(Ans(1))Ans(3) ;calculate #3*ln(#2)*ln(#1)
Ans(6)ln(Ans(5))ln(Ans(4 ;calculate #6*ln(#5)*ln(#4)
> ;is the first result greater than the
; second result?
; leave answer in "Ans"
;implicit print of "Ans"
Note: TI-BASIC is a tokenized language. Character count does not equal byte count.
edited yesterday
answered yesterday
TauTau
1,148519
1,148519
$begingroup$
I’m not that familiar with TI-BASIC, but this seems to belog(x) × y × z
rather thanlog(x) × y ^ z
. This won’t necessarily lead to the same ordering as the original inequality.
$endgroup$
– Nick Kennedy
yesterday
$begingroup$
@NickKennedy Yes, you are correct about that! I'll update the post to account for this.
$endgroup$
– Tau
yesterday
add a comment |
$begingroup$
I’m not that familiar with TI-BASIC, but this seems to belog(x) × y × z
rather thanlog(x) × y ^ z
. This won’t necessarily lead to the same ordering as the original inequality.
$endgroup$
– Nick Kennedy
yesterday
$begingroup$
@NickKennedy Yes, you are correct about that! I'll update the post to account for this.
$endgroup$
– Tau
yesterday
$begingroup$
I’m not that familiar with TI-BASIC, but this seems to be
log(x) × y × z
rather than log(x) × y ^ z
. This won’t necessarily lead to the same ordering as the original inequality.$endgroup$
– Nick Kennedy
yesterday
$begingroup$
I’m not that familiar with TI-BASIC, but this seems to be
log(x) × y × z
rather than log(x) × y ^ z
. This won’t necessarily lead to the same ordering as the original inequality.$endgroup$
– Nick Kennedy
yesterday
$begingroup$
@NickKennedy Yes, you are correct about that! I'll update the post to account for this.
$endgroup$
– Tau
yesterday
$begingroup$
@NickKennedy Yes, you are correct about that! I'll update the post to account for this.
$endgroup$
– Tau
yesterday
add a comment |
$begingroup$
bc -l, 47 bytes
l(read())*read()^read()>l(read())*read()^read()
with the input read from STDIN
, one integer per line.
bc
is pretty fast; it handles a=b=c=d=e=f=1,000,000 in a little over a second on my laptop.
$endgroup$
$begingroup$
I love a bc answer! Just need one in bash now :)
$endgroup$
– Anush
19 hours ago
add a comment |
$begingroup$
bc -l, 47 bytes
l(read())*read()^read()>l(read())*read()^read()
with the input read from STDIN
, one integer per line.
bc
is pretty fast; it handles a=b=c=d=e=f=1,000,000 in a little over a second on my laptop.
$endgroup$
$begingroup$
I love a bc answer! Just need one in bash now :)
$endgroup$
– Anush
19 hours ago
add a comment |
$begingroup$
bc -l, 47 bytes
l(read())*read()^read()>l(read())*read()^read()
with the input read from STDIN
, one integer per line.
bc
is pretty fast; it handles a=b=c=d=e=f=1,000,000 in a little over a second on my laptop.
$endgroup$
bc -l, 47 bytes
l(read())*read()^read()>l(read())*read()^read()
with the input read from STDIN
, one integer per line.
bc
is pretty fast; it handles a=b=c=d=e=f=1,000,000 in a little over a second on my laptop.
answered yesterday
AbigailAbigail
51617
51617
$begingroup$
I love a bc answer! Just need one in bash now :)
$endgroup$
– Anush
19 hours ago
add a comment |
$begingroup$
I love a bc answer! Just need one in bash now :)
$endgroup$
– Anush
19 hours ago
$begingroup$
I love a bc answer! Just need one in bash now :)
$endgroup$
– Anush
19 hours ago
$begingroup$
I love a bc answer! Just need one in bash now :)
$endgroup$
– Anush
19 hours ago
add a comment |
$begingroup$
CJam, 11 bytes
{##@@#@#<}
Try it online!
Explanation:
{ }
Marks a code-block, or a function. Let's say the parameters are a1, a2, a3, b1, b2, b3.
##
Does power twice => a1, a2, a3, b1^(b2^b3)
@@
Rotates stack twice => a1, b1^(b2^b3), a2, a3
#
Power => a1, b1^(b2^b3), a2^a3
@
Rotate and swap top two stack elements => b1^(b2^b3), a1, a2^a3
#
Power => b1^(b2^b3), a1^(a2^a3)
<
Since we now have the two arguments for >
the wrong way round, we use <
instead. There is implicit output at the end.
$endgroup$
$begingroup$
This can’t really be computing 20^20^20 for example, can it? That would be too large.
$endgroup$
– Anush
18 hours ago
1
$begingroup$
This doesn't handle extremely large numbers correctly. For example, 20^20^10 errors in an integer overflow
$endgroup$
– Jo King
9 hours ago
add a comment |
$begingroup$
CJam, 11 bytes
{##@@#@#<}
Try it online!
Explanation:
{ }
Marks a code-block, or a function. Let's say the parameters are a1, a2, a3, b1, b2, b3.
##
Does power twice => a1, a2, a3, b1^(b2^b3)
@@
Rotates stack twice => a1, b1^(b2^b3), a2, a3
#
Power => a1, b1^(b2^b3), a2^a3
@
Rotate and swap top two stack elements => b1^(b2^b3), a1, a2^a3
#
Power => b1^(b2^b3), a1^(a2^a3)
<
Since we now have the two arguments for >
the wrong way round, we use <
instead. There is implicit output at the end.
$endgroup$
$begingroup$
This can’t really be computing 20^20^20 for example, can it? That would be too large.
$endgroup$
– Anush
18 hours ago
1
$begingroup$
This doesn't handle extremely large numbers correctly. For example, 20^20^10 errors in an integer overflow
$endgroup$
– Jo King
9 hours ago
add a comment |
$begingroup$
CJam, 11 bytes
{##@@#@#<}
Try it online!
Explanation:
{ }
Marks a code-block, or a function. Let's say the parameters are a1, a2, a3, b1, b2, b3.
##
Does power twice => a1, a2, a3, b1^(b2^b3)
@@
Rotates stack twice => a1, b1^(b2^b3), a2, a3
#
Power => a1, b1^(b2^b3), a2^a3
@
Rotate and swap top two stack elements => b1^(b2^b3), a1, a2^a3
#
Power => b1^(b2^b3), a1^(a2^a3)
<
Since we now have the two arguments for >
the wrong way round, we use <
instead. There is implicit output at the end.
$endgroup$
CJam, 11 bytes
{##@@#@#<}
Try it online!
Explanation:
{ }
Marks a code-block, or a function. Let's say the parameters are a1, a2, a3, b1, b2, b3.
##
Does power twice => a1, a2, a3, b1^(b2^b3)
@@
Rotates stack twice => a1, b1^(b2^b3), a2, a3
#
Power => a1, b1^(b2^b3), a2^a3
@
Rotate and swap top two stack elements => b1^(b2^b3), a1, a2^a3
#
Power => b1^(b2^b3), a1^(a2^a3)
<
Since we now have the two arguments for >
the wrong way round, we use <
instead. There is implicit output at the end.
answered 19 hours ago
loladlolad
482213
482213
$begingroup$
This can’t really be computing 20^20^20 for example, can it? That would be too large.
$endgroup$
– Anush
18 hours ago
1
$begingroup$
This doesn't handle extremely large numbers correctly. For example, 20^20^10 errors in an integer overflow
$endgroup$
– Jo King
9 hours ago
add a comment |
$begingroup$
This can’t really be computing 20^20^20 for example, can it? That would be too large.
$endgroup$
– Anush
18 hours ago
1
$begingroup$
This doesn't handle extremely large numbers correctly. For example, 20^20^10 errors in an integer overflow
$endgroup$
– Jo King
9 hours ago
$begingroup$
This can’t really be computing 20^20^20 for example, can it? That would be too large.
$endgroup$
– Anush
18 hours ago
$begingroup$
This can’t really be computing 20^20^20 for example, can it? That would be too large.
$endgroup$
– Anush
18 hours ago
1
1
$begingroup$
This doesn't handle extremely large numbers correctly. For example, 20^20^10 errors in an integer overflow
$endgroup$
– Jo King
9 hours ago
$begingroup$
This doesn't handle extremely large numbers correctly. For example, 20^20^10 errors in an integer overflow
$endgroup$
– Jo King
9 hours ago
add a comment |
$begingroup$
C++ (gcc), 86 bytes
Thanks to @ØrjanJohansen for pointing out a flaw in this and @Ourous for giving a fix.
#import<cmath>
int a(int i[]){return pow(i[1],i[2])/pow(i[4],i[5])>log(i[3])/log(*i);}
Try it online!
Takes input as a 6-integer array. Returns 1 if $a^{b^c} > d^{e^f}$, 0 otherwise.
$endgroup$
$begingroup$
The formula after takinglog
twice should bei[2]*log(i[1])+log(log(*i))
. E.g. the current one will fail for2^2^20 > 4^2^18
.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: good catch! I guess I have to use thepow
method then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
The alternate one has the2^3^12 == 8^3^11
problem I've pointed out for others.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: well, I guess I'm using your fixed formula then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
Oh, I'm afraid that formula is only mathematically correct. It still has a floating point error problem, just with a different case,2^3^20 == 8^3^19
. In fact on average the power method fails for fewer, probably because it tends to multiply by powers of two exactly. Others have managed to make it work by just tweaking it slightly.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 3 more comments
$begingroup$
C++ (gcc), 86 bytes
Thanks to @ØrjanJohansen for pointing out a flaw in this and @Ourous for giving a fix.
#import<cmath>
int a(int i[]){return pow(i[1],i[2])/pow(i[4],i[5])>log(i[3])/log(*i);}
Try it online!
Takes input as a 6-integer array. Returns 1 if $a^{b^c} > d^{e^f}$, 0 otherwise.
$endgroup$
$begingroup$
The formula after takinglog
twice should bei[2]*log(i[1])+log(log(*i))
. E.g. the current one will fail for2^2^20 > 4^2^18
.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: good catch! I guess I have to use thepow
method then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
The alternate one has the2^3^12 == 8^3^11
problem I've pointed out for others.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: well, I guess I'm using your fixed formula then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
Oh, I'm afraid that formula is only mathematically correct. It still has a floating point error problem, just with a different case,2^3^20 == 8^3^19
. In fact on average the power method fails for fewer, probably because it tends to multiply by powers of two exactly. Others have managed to make it work by just tweaking it slightly.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 3 more comments
$begingroup$
C++ (gcc), 86 bytes
Thanks to @ØrjanJohansen for pointing out a flaw in this and @Ourous for giving a fix.
#import<cmath>
int a(int i[]){return pow(i[1],i[2])/pow(i[4],i[5])>log(i[3])/log(*i);}
Try it online!
Takes input as a 6-integer array. Returns 1 if $a^{b^c} > d^{e^f}$, 0 otherwise.
$endgroup$
C++ (gcc), 86 bytes
Thanks to @ØrjanJohansen for pointing out a flaw in this and @Ourous for giving a fix.
#import<cmath>
int a(int i[]){return pow(i[1],i[2])/pow(i[4],i[5])>log(i[3])/log(*i);}
Try it online!
Takes input as a 6-integer array. Returns 1 if $a^{b^c} > d^{e^f}$, 0 otherwise.
edited 10 hours ago
answered yesterday
Neil A.Neil A.
1,438120
1,438120
$begingroup$
The formula after takinglog
twice should bei[2]*log(i[1])+log(log(*i))
. E.g. the current one will fail for2^2^20 > 4^2^18
.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: good catch! I guess I have to use thepow
method then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
The alternate one has the2^3^12 == 8^3^11
problem I've pointed out for others.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: well, I guess I'm using your fixed formula then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
Oh, I'm afraid that formula is only mathematically correct. It still has a floating point error problem, just with a different case,2^3^20 == 8^3^19
. In fact on average the power method fails for fewer, probably because it tends to multiply by powers of two exactly. Others have managed to make it work by just tweaking it slightly.
$endgroup$
– Ørjan Johansen
22 hours ago
|
show 3 more comments
$begingroup$
The formula after takinglog
twice should bei[2]*log(i[1])+log(log(*i))
. E.g. the current one will fail for2^2^20 > 4^2^18
.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: good catch! I guess I have to use thepow
method then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
The alternate one has the2^3^12 == 8^3^11
problem I've pointed out for others.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: well, I guess I'm using your fixed formula then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
Oh, I'm afraid that formula is only mathematically correct. It still has a floating point error problem, just with a different case,2^3^20 == 8^3^19
. In fact on average the power method fails for fewer, probably because it tends to multiply by powers of two exactly. Others have managed to make it work by just tweaking it slightly.
$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
The formula after taking
log
twice should be i[2]*log(i[1])+log(log(*i))
. E.g. the current one will fail for 2^2^20 > 4^2^18
.$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
The formula after taking
log
twice should be i[2]*log(i[1])+log(log(*i))
. E.g. the current one will fail for 2^2^20 > 4^2^18
.$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: good catch! I guess I have to use the
pow
method then.$endgroup$
– Neil A.
22 hours ago
$begingroup$
@ØrjanJohansen: good catch! I guess I have to use the
pow
method then.$endgroup$
– Neil A.
22 hours ago
$begingroup$
The alternate one has the
2^3^12 == 8^3^11
problem I've pointed out for others.$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
The alternate one has the
2^3^12 == 8^3^11
problem I've pointed out for others.$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
@ØrjanJohansen: well, I guess I'm using your fixed formula then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
@ØrjanJohansen: well, I guess I'm using your fixed formula then.
$endgroup$
– Neil A.
22 hours ago
$begingroup$
Oh, I'm afraid that formula is only mathematically correct. It still has a floating point error problem, just with a different case,
2^3^20 == 8^3^19
. In fact on average the power method fails for fewer, probably because it tends to multiply by powers of two exactly. Others have managed to make it work by just tweaking it slightly.$endgroup$
– Ørjan Johansen
22 hours ago
$begingroup$
Oh, I'm afraid that formula is only mathematically correct. It still has a floating point error problem, just with a different case,
2^3^20 == 8^3^19
. In fact on average the power method fails for fewer, probably because it tends to multiply by powers of two exactly. Others have managed to make it work by just tweaking it slightly.$endgroup$
– Ørjan Johansen
22 hours ago
|
show 3 more comments
$begingroup$
Jelly, 8 bytes
l⁵×*/}>/
Try it online!
Based on Arnauld’s JS answer. Expects as input [a1, b1]
as left argument and [[a2, b2], [a3, b3]]
as right argument.
Now changed to use log to the base 10 which as far as correctly handles all the possible inputs in the range specified. Thanks to Ørjan Johansen for finding the original problem!
$endgroup$
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
Your Python TIO is incorrect.. You have8*
instead of8**
. @ØrjanJohansen is indeed correct that2**(3**12) > 8**(3**11)
is falsey, since they are equal.
$endgroup$
– Kevin Cruijssen
17 hours ago
$begingroup$
@KevinCruijssen oops. Yes they are indeed equal. The reason the original two are marked as different relates to floating point error.
$endgroup$
– Nick Kennedy
17 hours ago
add a comment |
$begingroup$
Jelly, 8 bytes
l⁵×*/}>/
Try it online!
Based on Arnauld’s JS answer. Expects as input [a1, b1]
as left argument and [[a2, b2], [a3, b3]]
as right argument.
Now changed to use log to the base 10 which as far as correctly handles all the possible inputs in the range specified. Thanks to Ørjan Johansen for finding the original problem!
$endgroup$
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
Your Python TIO is incorrect.. You have8*
instead of8**
. @ØrjanJohansen is indeed correct that2**(3**12) > 8**(3**11)
is falsey, since they are equal.
$endgroup$
– Kevin Cruijssen
17 hours ago
$begingroup$
@KevinCruijssen oops. Yes they are indeed equal. The reason the original two are marked as different relates to floating point error.
$endgroup$
– Nick Kennedy
17 hours ago
add a comment |
$begingroup$
Jelly, 8 bytes
l⁵×*/}>/
Try it online!
Based on Arnauld’s JS answer. Expects as input [a1, b1]
as left argument and [[a2, b2], [a3, b3]]
as right argument.
Now changed to use log to the base 10 which as far as correctly handles all the possible inputs in the range specified. Thanks to Ørjan Johansen for finding the original problem!
$endgroup$
Jelly, 8 bytes
l⁵×*/}>/
Try it online!
Based on Arnauld’s JS answer. Expects as input [a1, b1]
as left argument and [[a2, b2], [a3, b3]]
as right argument.
Now changed to use log to the base 10 which as far as correctly handles all the possible inputs in the range specified. Thanks to Ørjan Johansen for finding the original problem!
edited 8 hours ago
answered yesterday
Nick KennedyNick Kennedy
1,92149
1,92149
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
Your Python TIO is incorrect.. You have8*
instead of8**
. @ØrjanJohansen is indeed correct that2**(3**12) > 8**(3**11)
is falsey, since they are equal.
$endgroup$
– Kevin Cruijssen
17 hours ago
$begingroup$
@KevinCruijssen oops. Yes they are indeed equal. The reason the original two are marked as different relates to floating point error.
$endgroup$
– Nick Kennedy
17 hours ago
add a comment |
1
$begingroup$
I believe this fails for2^3^12 == 8^3^11
.
$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
Your Python TIO is incorrect.. You have8*
instead of8**
. @ØrjanJohansen is indeed correct that2**(3**12) > 8**(3**11)
is falsey, since they are equal.
$endgroup$
– Kevin Cruijssen
17 hours ago
$begingroup$
@KevinCruijssen oops. Yes they are indeed equal. The reason the original two are marked as different relates to floating point error.
$endgroup$
– Nick Kennedy
17 hours ago
1
1
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
I believe this fails for
2^3^12 == 8^3^11
.$endgroup$
– Ørjan Johansen
23 hours ago
$begingroup$
Your Python TIO is incorrect.. You have
8*
instead of 8**
. @ØrjanJohansen is indeed correct that 2**(3**12) > 8**(3**11)
is falsey, since they are equal.$endgroup$
– Kevin Cruijssen
17 hours ago
$begingroup$
Your Python TIO is incorrect.. You have
8*
instead of 8**
. @ØrjanJohansen is indeed correct that 2**(3**12) > 8**(3**11)
is falsey, since they are equal.$endgroup$
– Kevin Cruijssen
17 hours ago
$begingroup$
@KevinCruijssen oops. Yes they are indeed equal. The reason the original two are marked as different relates to floating point error.
$endgroup$
– Nick Kennedy
17 hours ago
$begingroup$
@KevinCruijssen oops. Yes they are indeed equal. The reason the original two are marked as different relates to floating point error.
$endgroup$
– Nick Kennedy
17 hours ago
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
6
$begingroup$
It would probably also benefit from normal, broadly-defined decision-problem output instead of being restricted to
1
and0
$endgroup$
– Unrelated String
yesterday
2
$begingroup$
Can we take the inputs in any order?
$endgroup$
– Kevin Cruijssen
yesterday
7
$begingroup$
@Anush Imposing a specific order of inputs it not common at all. You should specify that very clearly in the text. By default imput order and format are flexible
$endgroup$
– Luis Mendo
yesterday
3
$begingroup$
@Anush The question cannot always be correct. If floating-point limitations are not allowed, the code will have to use integers, or big integers, or symbolic math. Each of those eventually fail (due to data-type or memory limitations) for big enough inputs
$endgroup$
– Luis Mendo
yesterday
7
$begingroup$
Suggested test case:
2^3^12 == 8^3^11
. Evil grin. This is smaller than I'd like, but I couldn't find a bigger one where floating point error matters.$endgroup$
– Ørjan Johansen
23 hours ago