Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#Haskell, 67 bytes

Haskell, 67 bytes

Here's the code:

a&b|b<2=0|a==b=1+2&(b-1)|mod b a<1=1+2&(b-div b a)|1<2=(a+1)&b
(2&)

And here's one reason why Haskell is awesome:

f = (2&)
(-->) :: Eq a => a -> a -> Bool
(-->) = (==)
h=[f(5) --> 3
 ,f(30) --> 6
 ,f(31) --> 7
 ,f(32) --> 5
 ,f(100) --> 8
 ,f(200) --> 9
 ,f(2016^155) --> 2015
 ]

Yes, in Haskell you can define --> to be equivalent to ==.

#Haskell, 67 bytes

Here's the code:

a&b|b<2=0|a==b=1+2&(b-1)|mod b a<1=1+2&(b-div b a)|1<2=(a+1)&b
(2&)

And here's one reason why Haskell is awesome:

f = (2&)
(-->) :: Eq a => a -> a -> Bool
(-->) = (==)
h=[f(5) --> 3
 ,f(30) --> 6
 ,f(31) --> 7
 ,f(32) --> 5
 ,f(100) --> 8
 ,f(200) --> 9
 ,f(2016^155) --> 2015
 ]

Yes, in Haskell you can define --> to be equivalent to ==.

Haskell, 67 bytes

Here's the code:

a&b|b<2=0|a==b=1+2&(b-1)|mod b a<1=1+2&(b-div b a)|1<2=(a+1)&b
(2&)

And here's one reason why Haskell is awesome:

f = (2&)
(-->) :: Eq a => a -> a -> Bool
(-->) = (==)
h=[f(5) --> 3
 ,f(30) --> 6
 ,f(31) --> 7
 ,f(32) --> 5
 ,f(100) --> 8
 ,f(200) --> 9
 ,f(2016^155) --> 2015
 ]

Yes, in Haskell you can define --> to be equivalent to ==.

added 2 characters in body
Source Link
Michael Klein
  • 2.4k
  • 15
  • 29

#Haskell, 6567 bytes

Here's the code:

a&b|b<2=0|a==b=1+2&(b-1)|mod b a<1=1+2&(b-div b a)|1<2=(a+1)&b
(2&)

And here's one reason why Haskell is awesome:

f = (2&)
(-->) :: Eq a => a -> a -> Bool
(-->) = (==)
h=[f(5) --> 3
 ,f(30) --> 6
 ,f(31) --> 7
 ,f(32) --> 5
 ,f(100) --> 8
 ,f(200) --> 9
 ,f(2016^155) --> 2015
 ]

Yes, in Haskell you can define --> to be equivalent to ==.

#Haskell, 65 bytes

Here's the code:

a&b|b<2=0|a==b=1+2&(b-1)|mod b a<1=1+2&(b-div b a)|1<2=(a+1)&b
2&

And here's one reason why Haskell is awesome:

f = (2&)
(-->) :: Eq a => a -> a -> Bool
(-->) = (==)
h=[f(5) --> 3
 ,f(30) --> 6
 ,f(31) --> 7
 ,f(32) --> 5
 ,f(100) --> 8
 ,f(200) --> 9
 ,f(2016^155) --> 2015
 ]

Yes, in Haskell you can define --> to be equivalent to ==.

#Haskell, 67 bytes

Here's the code:

a&b|b<2=0|a==b=1+2&(b-1)|mod b a<1=1+2&(b-div b a)|1<2=(a+1)&b
(2&)

And here's one reason why Haskell is awesome:

f = (2&)
(-->) :: Eq a => a -> a -> Bool
(-->) = (==)
h=[f(5) --> 3
 ,f(30) --> 6
 ,f(31) --> 7
 ,f(32) --> 5
 ,f(100) --> 8
 ,f(200) --> 9
 ,f(2016^155) --> 2015
 ]

Yes, in Haskell you can define --> to be equivalent to ==.

Source Link
Michael Klein
  • 2.4k
  • 15
  • 29

#Haskell, 65 bytes

Here's the code:

a&b|b<2=0|a==b=1+2&(b-1)|mod b a<1=1+2&(b-div b a)|1<2=(a+1)&b
2&

And here's one reason why Haskell is awesome:

f = (2&)
(-->) :: Eq a => a -> a -> Bool
(-->) = (==)
h=[f(5) --> 3
 ,f(30) --> 6
 ,f(31) --> 7
 ,f(32) --> 5
 ,f(100) --> 8
 ,f(200) --> 9
 ,f(2016^155) --> 2015
 ]

Yes, in Haskell you can define --> to be equivalent to ==.

AltStyle によって変換されたページ (->オリジナル) /