Skip to main content
added 159 characters in body
Source Link
Aiden Chow
  • 14.2k
  • 1
  • 17
  • 55

Desmos, 90 82 59 bytes

f(m,d)=total([0,31,28,31,30,31,30,31,31,30,31,30][1...m])+d

Saved 23 bytes 'cause I was so dumb... I've been trying to do some clever list manipulation to save bytes, but it never came to my mind to just put the list itself.

Very Brief Explanation:

[0,31,28,31,30,31,30,31,31,30,31,30]: The number of days in each month(excluding December), with an extra 0 element at the beginning.

total( ... [1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!

Try It On Desmos! - Prettified

Solution using Lynn's "closed form" formula, 34 bytes

f(m,d)=floor(275m/9)-30+d-mod(2,m)

Desmos, 90 82 59 bytes

f(m,d)=total([0,31,28,31,30,31,30,31,31,30,31,30][1...m])+d

Saved 23 bytes 'cause I was so dumb... I've been trying to do some clever list manipulation to save bytes, but it never came to my mind to just put the list itself.

Very Brief Explanation:

[0,31,28,31,30,31,30,31,31,30,31,30]: The number of days in each month(excluding December), with an extra 0 element at the beginning.

total( ... [1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!

Try It On Desmos! - Prettified

Desmos, 90 82 59 bytes

f(m,d)=total([0,31,28,31,30,31,30,31,31,30,31,30][1...m])+d

Saved 23 bytes 'cause I was so dumb... I've been trying to do some clever list manipulation to save bytes, but it never came to my mind to just put the list itself.

Very Brief Explanation:

[0,31,28,31,30,31,30,31,31,30,31,30]: The number of days in each month(excluding December), with an extra 0 element at the beginning.

total( ... [1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!

Try It On Desmos! - Prettified

Solution using Lynn's "closed form" formula, 34 bytes

f(m,d)=floor(275m/9)-30+d-mod(2,m)
deleted 102 characters in body
Source Link
Aiden Chow
  • 14.2k
  • 1
  • 17
  • 55

Desmos, 90 8282 59 bytes

f(m,d)=total((mod(join([0...7],[1...4])31,2)+join([-28,31,30,031,-2]30,[0...9]0)+30)[131,31,30,31,30][1...m])+d

99% sure this can be golfed. I feel like there should be a more mathematical way to solve this?Saved 23 bytes 'cause I was so dumb... I've been trying to do some clever list manipulation to save bytes, but it never came to my mind to just put the list itself.

Very Brief Explanation:

mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30: Constructs the list [0,31,28,31,30,31,30,31,31,30,31,30,31]30](The: The number of days in each month(excluding December), with an extra 0 element at the beginning. In hindsight, I actually don't need the last element, but it doesn't save any bytes to fix.)

total(( ... )[1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!Try It On Desmos!

Try It On Desmos! - PrettifiedTry It On Desmos! - Prettified

Desmos, 90 82 bytes

f(m,d)=total((mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30)[1...m])+d

99% sure this can be golfed. I feel like there should be a more mathematical way to solve this?

Very Brief Explanation:

mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30: Constructs the list [0,31,28,31,30,31,30,31,31,30,31,30,31](The number of days in each month, with an extra 0 element at the beginning. In hindsight, I actually don't need the last element, but it doesn't save any bytes to fix.)

total(( ... )[1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!

Try It On Desmos! - Prettified

Desmos, 90 82 59 bytes

f(m,d)=total([0,31,28,31,30,31,30,31,31,30,31,30][1...m])+d

Saved 23 bytes 'cause I was so dumb... I've been trying to do some clever list manipulation to save bytes, but it never came to my mind to just put the list itself.

Very Brief Explanation:

[0,31,28,31,30,31,30,31,31,30,31,30]: The number of days in each month(excluding December), with an extra 0 element at the beginning.

total( ... [1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!

Try It On Desmos! - Prettified

added 498 characters in body
Source Link
Aiden Chow
  • 14.2k
  • 1
  • 17
  • 55

Desmos, 90 82 bytes

f(m,d)=total((mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30)[1...m])+d

99% sure this can be golfed. I feel like there should be a more mathematical way to solve this?

Very Brief Explanation:

mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30: Constructs the list [0,31,28,31,30,31,30,31,31,30,31,30,31](The number of days in each month, with an extra 0 element at the beginning. In hindsight, I actually don't need the last element, but it doesn't save any bytes to fix.)

total(( ... )[1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!

Try It On Desmos! - Prettified

Desmos, 90 82 bytes

f(m,d)=total((mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30)[1...m])+d

99% sure this can be golfed.

Try It On Desmos!

Try It On Desmos! - Prettified

Desmos, 90 82 bytes

f(m,d)=total((mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30)[1...m])+d

99% sure this can be golfed. I feel like there should be a more mathematical way to solve this?

Very Brief Explanation:

mod(join([0...7],[1...4]),2)+join([-30,0,-2],[0...9]0)+30: Constructs the list [0,31,28,31,30,31,30,31,31,30,31,30,31](The number of days in each month, with an extra 0 element at the beginning. In hindsight, I actually don't need the last element, but it doesn't save any bytes to fix.)

total(( ... )[1...m])+d: Sum of the first m elements of the list explained above, then add d.

Try It On Desmos!

Try It On Desmos! - Prettified

edited body
Source Link
Aiden Chow
  • 14.2k
  • 1
  • 17
  • 55
Loading
added 2 characters in body
Source Link
Aiden Chow
  • 14.2k
  • 1
  • 17
  • 55
Loading
Source Link
Aiden Chow
  • 14.2k
  • 1
  • 17
  • 55
Loading