[Question]
  [
This simple challenge is very similar to this one: [How many days in a month?](https://codegolf.stackexchange.com/questions/146555) The only difference is you **yield the number of days in a month given the index of the month** instead of its name.
The reason I ask this near-duplicate is curiosity about mathematical patterns in the sequence of numbers. For example, a simple observation is that even-indexed months have 31 until August and then it flips — but golf that observation and/or make better ones that yield better strokes...
**INPUT**: Integer indicating the month; `1` through `12`. (Optionally, you can accept `0`-indexed month numbers from `0` to `11`.)
**OUTPUT**: Number of days in that month. February can return `28` or `29`.
**Complete I/O table:**
```
INPUT   :   OUTPUT
  1          31
  2          28 or 29 
  3          31
  4          30
  5          31
  6          30
  7          31
  8          31
  9          30
 10          31
 11          30
 12          31
```
  
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~13~~ 12 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Anonymous tacit prefix function. 0-indexed. February is 29.
```
31-1∘=+2|7∘|
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///39hQ1/BRxwxbbaMacyBd8z/tUduER719j/qmevo/6mo@tN74UdtEIC84yBlIhnh4Bv9PUzBQMFQwUjBWMFEwVTBTMFewULBUMAQKGgIA "APL (Dyalog Unicode) – Try It Online")
`31-` thirty-one minus…
 `1∘=` the equal-to-one'ness…
  `+` plus…
   `2|` the two-mod of…
    `7∘|` the seven-mod'ness
> 
> The reason I ask this near-duplicate is curiosity about mathematical patterns in the sequence of numbers. For example, a simple observation is that even-indexed months have 31 until August and then it flips — but golf that observation and/or make better ones that yield better strokes...
> 
> 
> 
This solution implements the following mathematical pattern:
$$f(x)=31-[x=1]-\big((x\mod 7)\mod 2\big)$$
or
$$f(x)=31-x-\left[x=1\right]+7\left\lfloor\frac{x}7\right\rfloor+2\left\lfloor x-7\left\lfloor\frac{x}7\right\rfloor\over2\right\rfloor$$
[Answer]
# [Poetic](https://mcaweb.matc.edu/winslojr/vicom128/final/index.html), 706 bytes
```
counting a day,one month<t-o>twelve
i got frustrated doing a list
i do say,o,i edited a list,a month&a day count
in twelve(in December)to one(January)i listed a day"s count,then the numeral months
and once i am ready,o,i think i got a number to say
a number,o,i know a count
o,i say i am thirty if one"s short
i am ready,o,i know a count is not a thirty if we switch it
a long,a short,a etc.i switch
i do think i want a count of Febr-u"ry=two n eight:a case of a month"s age as shorter than the others"s
a day"s a day,i reckon
i know,i am clever
o,a date"s count at min=a thirty-day,or affix a one,i think
i do start&i produce threes if ever i am thirty
P.S.note:i index by one,i receive any-format numbers
```
[Try it online!](https://mcaweb.matc.edu/winslojr/vicom128/final/tio/index.html?VVJBbuMwDLz7FUQOQQM4OfRYbPe06GFPC@wLGIu2iNjUQqLj@vUtJdnb9GLLJmc4M1QXZlGWARAcrm0QgimI@h96Dj91ofFODcMQFPo4J42o5MCFihg5qVVdgJSxLQM5zg211GLlOhZu6PKohgUq7ZOdflFH05XiSQPY6KffKDPG9cQFX4gMeUgV26onQ3sCmSeKOFb61KA4g3cEDDhBJHRVjXqWG1T5mEE2CrSobfbv0niTsFhHVZh/WEclM4qodu6zPhOSfIjZ87c5j3DgBFLmfUEXgrSwdh5YbfAYZLBsCpW9SbsLbw01zV33gqL/eUMPb3SN5/kQ11ddAggQD15frAET5fqWt8nEgQA3tdmzxxpcsEdMB4tsC7aunc1MdwvSVC9t8deNdKdoceQepX0LgAoTy@tu8FzuTQTse343Pstpj367G4pRjwz/YnCzLUl9JEo5l8z/GHPz5/L3YuHRCwOLo3e4rhuf6SO@mylZz32Ik4mo@0sfzx9XdJ8)
As noted in the final line of the program, this program takes months as 1-based indices, and can take both simple numbers and numbers with a leading 0. (How's *that* for code comments?)
In pseudocode, my approach was basically like this:
```
N = input(); // Poetic doesn't support native numerical input, only input as ASCII codes; I basically have to write myself a number input routine every time
DIGIT = 49 // ASCII value for "1"; I would set it to 3, but that would be slightly longer
if (N>7) N++; // this accounts for the July->August parity shift
if (N!=2) { // if not February...
    DIGIT += 2; // now it's "3"
    print(DIGIT); // output: "3"
    DIGIT -= 3; // and now it's "0"...
    if (N%2==1) THREE++; // ...unless N is odd
    print(DIGIT); // output: "30" if short month, "31" if long month
} else { // if February...
    DIGIT += 1; // now it's "2"
    print(DIGIT); // output: "2"
    DIGIT += 6; // now it's "8"
    print(DIGIT); // output: "28"
}
```
[Answer]
# [Pyke](https://github.com/muddyfish/PYKE), 4 bytes
```
~%R@
```
I have no idea how does this work (actually, after reading the source, I think I do, but Pyke seems **extremely** weird to me) as I simply used the second half of the Pyke answer by @Blue in the related question OP linked to.
[Try it online!](https://tio.run/##K6jMTv3/v041yOH/f2MA "Pyke – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 27 bytes
0-indexed.
Instead of indexing into a string, I get the day offset (from 28) for the month from a packed bit array. Luckily all the offsets fit in a two-bit representation, so the bit array fits in an integer: I just shift and mask the offset and add 28.
```
f(m){m=0xEEFBB3>>m*2&3|28;}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NI1ezOtfWoMLV1c3JydjOLlfLSM24xsjCuvZ/Zl6JQm5iZp5GWX5miqZCNZeCQlp@kQZIONPWwFoh08bQCEhqa2sqFBQBRdM0lHzz80oyFFRTFGztQGRKYmVxTJ6SjkKmjkKaRqampjVX7f9/yWk5ienF/3XLAQ "C (gcc) – Try It Online")
[Answer]
# JavaScript (ES6), 16 bytes
All solutions expect a 0-indexed input and output 29 days for February.
Using a decimal modulo.
```
n=>n%1.7+!~-n^31
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/P1i5P1VDPXFuxTjcvztjwf1p@kUaegq2CgbVCnoKNgqERkNbW1lRIzs8rzs9J1cvJT9fI01FI08jT1PwPAA "JavaScript (Node.js) – Try It Online")
---
Using a single integer modulo.
```
n=>30-!~-n|n%7^1
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/P1s7YQFexTjevJk/VPM7wf1p@kUaegq2CgbVCnoKNgqERkNbW1lRIzs8rzs9J1cvJT9fI01FI08jT1PwPAA "JavaScript (Node.js) – Try It Online")
---
Same approach as [Adám](https://codegolf.stackexchange.com/a/195887/58563) with 2 integer modulos.
```
n=>31-n%7%2-!~-n
```
[Try it online!](https://tio.run/##DcVBDkAwEAXQq4yFpE2NUAsL6i5NqRD5IyqWrl7e5u3@8Slc23kzZF5ydBlu6lpG2ZeWi5eRo1wK5KgZCDRSa/@N0RQESY6lPmRVqCgqaJ0/ "JavaScript (Node.js) – Try It Online")
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), 3 bytes
```
∂k=
```
Yep, there's a built-in.
[Try it online!](https://tio.run/##S0/MTPz//1FHU7bt//9GAA "Gaia – Try It Online")
```
∂k   List containing days in each month
  =  Index into it (implicit input)
```
[Answer]
# x86 Machine Code, 14 bytes
```
B8 B3 FB EE 00
01 C9
D3 E8
24 03
04 1C
C3
```
This is a straight port of [ErikF's C answer](https://codegolf.stackexchange.com/a/195904). The above bytes define a function that accepts a zero-indexed month (in the `ECX` register), and outputs the number of days (in the `AL` register, the lower-order bytes of the `EAX` register). The result is calculated by adding 28 to a fix-up parameter obtained from a sequenced vector of 2-bit values.
```
B8 B3 FB EE 00   mov    eax, 0x00EEFBB3    ; load bit vector into EAX
01 C9            add    ecx, ecx           ; \ index into the bit vector
D3 E8            shr    eax, cl            ; |   by shifting it right
24 03            and    al,  3             ; /   and keeping only the lowest 2 bits
04 1C            add    al,  28            ; add 28
C3               ret
```
**[Try it online!](https://tio.run/##fZFdT8IwFIavt19xMiXpYMKYkRgBE6NecOG9FyRLbcvWpHSkHwYx/HVn2ykRJfamp@3z9ny85IIILKu2tVLzSjIKpMYKHvCbXsinRpoacWlg7aM0fo/BrQOqmLbCTMNlWWK9LkuULM26eRXu5nx8NZkUeX6ZQa/H8HYpk0B@L0diSj3pnsk267YTlK5VRxHxz1eSvvikIRsWp5MForjukCPgBpI5TgB1LaUAoz401myscV1WXBumgGt4vHuG/uiXkCQAqJsQBCGXXncsvP8r/HlKuykqZqySh8Hu2zMuibCUwUwbypthfRvHwRDMJfKGRKtGAdJ8x0oDHOaQT902g3ExhcGAp3HkmGijnGiFkuAo9IqdhRprF1CgzuqhG1cGPANvdnpkfuoqi/Zx9FVZ7ov6ICuBK91@Ag "C (clang) – Try It Online")**
Note that we can do the `AND` and `ADD` on byte-sized operands, which results in 2-byte instructions, rather than the 3-byte instructions required to operate on double-words.
The big bloat here is that initial 32-bit `MOV` instruction required to load the bit vector, but this implementation is still significantly smaller than a solution implementing the mathematical algorithm cited by [Adam](https://codegolf.stackexchange.com/a/195887/58518): `(31 - ((month % 7) % 2) - (month == 1))`.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
7%É31αsΘ-
```
Same formula as [*@Adám*'s APL (Dyalog Unicode) answer](https://codegolf.stackexchange.com/a/195887/52210), which I've also partially used in [this earlier answer of mine](https://codegolf.stackexchange.com/questions/173104/the-work-day-countdown/173126#173126).
[Try it online.](https://tio.run/##yy9OTMpM/W9o5OZnr6TwqG2SgpK9n8t/c9XDncaG5zYWn5uh@1/nPwA)
**Explanation:**
```
7%         # Take the (implicit) input-integer modulo-7
  É        # Check whether it is odd (short for modulo-2)
   31α     # Take the absolute difference with 31
      s    # Swap to take the (implicit) input-integer again
       Θ   # 05AB1E truthify; 1 if n==1; 0 otherwise
        -  # And subtract this from the earlier number
           # (after which the result is output implicitly)
```
[Answer]
# [Python 3](https://docs.python.org/3/), 24 bytes
```
lambda n:31-n%7%2-(n==1)
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPythQN0/VXNVIVyPP1tZQ839afpFCnkJmnkJRYl56qoahkaYVl0JBUWZeiUaaRp6m5n8A "Python 3 – Try It Online")
Adaptation of [Adám's APL answer](https://codegolf.stackexchange.com/a/195887/87681)
---
Original answer:
# [Python 3](https://docs.python.org/3/), 29 bytes
```
lambda n:31^n%2^n//7^2*(n==1)
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPytgwLk/VKC5PX988zkhLI8/W1lDzf1p@kUKeQmaeQlFiXnqqhqGRphWXQkFRZl6JRppGnqbmfwA "Python 3 – Try It Online")
[Answer]
# [Turing Machine Code](http://morphett.info/turing/turing.html), 197 bytes
```
0 0 _ * j
0 1 _ r F
0 2 _ * j
0 3 2 * F
0 4 _ * j
0 5 2 * F
0 6 _ * j
0 7 _ * j
0 8 2 * F
0 9 _ * j
h * * * halt
j _ 3 r ǰ
ǰ _ 1 * h
F _ 2 r Ƒ
Ƒ _ 8 * h
F 0 2 * F
F 1 _ r j
N _ 0 * h
F 2 3 r N
```
[Try it online!](http://morphett.info/turing/turing.html?8f4d81596dcfd7859a1915b575e5df9d)
[Answer]
# [Python 3](https://docs.python.org/3/), 58 45 bytes
```
lambda x:'312831303130313130313031'[x*2:][:2]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fpmCrEPM/JzE3KSVRocJK3djQyMLY0NgAiuEs9egKLSOr2Ggro9j/BUWZeSUaaRqGmpr/AQ "Python 3 – Try It Online")
* A weak solution to get it started with an "unanalyzed" solution space
* Saved a few bytes by functionizing thanks to Jo King
[Answer]
# [PHP](https://php.net/), 31 bytes
```
<?=date(t,mktime(0,0,0,$argn));
```
[Try it online!](https://tio.run/##K8go@P/fxt42JbEkVaNEJze7JDM3VcNABwRVEovS8zQ1rf//N/mXX1CSmZ9X/F/XDQA "PHP – Try It Online")
Just using builtins really. Input month via STDIN, 1-indexed.
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 20 bytes
```
x=>"




"[x]
```
[Try it online!](https://tio.run/##Sy7WTS7O/O9Wmpdsk5lXogPEdmm2/yts7ZTkZeTlgBBMKEVXxP635krLL9IAqlDItDWwzrQxNLLO1NbWDC/KLEn1ycxL1UjTyNTUtP4PAA "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~42~~ ~~39~~ 35 bytes
```
lambda i:(30+(i%2==(i<8)),28)[i==2]
```
[Try it online!](https://tio.run/##Tc29DkAwEADg3VNYJL0wtFc/Je5JMBARl1AiFk9fk5zt277zudfDY1ioD9u4T/MYc6OsThUnSKS4dQAZOuiYCIdwXuzveFEGoo8otMJcWAhLYSV0wlpo9M@/zyCEFw "Python 2 – Try It Online")
Not the shortest Python solution but an alternative approach (1 indexed).
Shorter but not very interesting:
# [Python 2](https://docs.python.org/2/), 34 bytes
```
lambda i:int("303232332323"[i])+28
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHTKjOvREPJ2MDYCAjBhFJ0ZqymtpHF/4IioJxCmoahJheMaYRgGiOYJgimKYJphmCaI5gWCKYlgmlogMRGss/QSPM/AA "Python 2 – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), ~~29~~ 28 bytes
```
^o$
x
o{7}|oo
^
31*
__x|_o
```
Explanation:
```
^o$      match input equal to "o"
x        replace it with x
o{7}|oo  match 7 or 2 "o"s, whichever the regex engine prefers
         replace them with nothing (this happens to compute a%7%2)
^        match the beginning of string
31*      and replace it with 31 times the default character (_)
__x|_o   match __x or _o literally
         and erase them (that is, "x" means "erase two _" and "o" means "erase one _")
```
[Try it online!](https://tio.run/##K0otycxLNPyvqpHA9T8uX4Wrgiu/2ry2Jj@fiyuOy9hQiys@vqImPp/r/3@ufK58EAJjCAElYRScRjCQWMjMfAA "Retina – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), 46 bytes
```
func[m][b:(a: to now[1 m 1])+ 31 b/4: 1 b - a]
```
[Try it online!](https://tio.run/##DcUxCgIxEAXQ3lN8tlJEQtTGOYbtMEV2M0FhMwmbLOLpo695m8bx1MhySDTSbgtn4ZmOgdALrHzYI8PL6Yybx@zuhH@4IMjYtGroMPgruG5v61xDRPu2rtmtZQmrulysv5ojwwMTTUgwkfED "Red – Try It Online")
A verbose solution that literally calculates the number of days in the given month (28 for february - year 1 AD)
## Explanation:
```
Red[]
f: func[m][
    a: to now [1 m 1]   ; make a date dd-mm-yyyy (1st of the "month" year 1 AD)
    b: a + 31           ; add 31 days to it
    b/4: 1              ; and go back to the 1st day of the new month
    b - a               ; subtract the initial date from the new one 
]
```
[Answer]
# [Haskell](https://www.haskell.org/), 37 bytes
Not in any way clever, but there you go. Pretty much checks all the non-31-day months and if it isn't any of them it falls back on 31.
```
f 2=28;f m|elem m[4,6,9,11]=30;f _=31
```
[Try it online!](https://tio.run/##HchBCsIwEAXQ/T9FFi4UQugktbZITiIig05oMInSVNx49yi@5Zu53iWlljkWH8sqC19XtVGvkmKRajI/t3V@vE0wi/BtZ/7dgrLejseg8keSZJVPvR70pInO3nW/v3hHrREsHHrsMeCAEROoAxHIfgE "Haskell – Try It Online")
[Answer]
## Excel, 29 bytes
```
=DAY(EOMONTH(DATE(0,B1,1),0))
```
Where `B1` is the month number (1-based).
[Answer]
As suggested by @Xcali it can be even shorter:
# [Perl 5](https://www.perl.org/), 35 bytes
```
$_=substr"3128".3130313031x2,$_*2,2
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3ra4NKm4pEjJ2NDIQknP2NDYAIIrjHRU4rWMdIz@/zf8l19QkpmfV/xftwAA "Perl 5 – Try It Online")
As suggested by @manatwork this can be shortened substantial:
# [Perl 5](https://www.perl.org/), 39 bytes
```
("3128".3130313031x2)=~/(..){$_}/;$_=$1
```
[Try it online!](https://tio.run/##K0gtyjH9/1/J2NDIwtjQ2ACK4Swl2zp9DT09zWqV@Fp9a5V4WxXD//@N/uUXlGTm5xX/1y0AAA "Perl 5 – Try It Online")
~~Perl (And because I like regex, a first humble attempt):~~
# [Perl 5](https://www.perl.org/), 60 bytes
```
print $1 if "312831303130313130313031" =~ /(..){$ARGV[0]}/g;
```
[Try it online!](https://tio.run/##K0gtyjH9/7@gKDOvREHFUCEzTUHJ2NDIwtjQ2ACK4SwlBds6BX0NPT3NahXHIPewaIPYWv106////xsBAA "Perl 5 – Try It Online")
Invoke via `perl -e` and user supplied input, e.g. `2` for the month, at command line argument with index 0.
[Answer]
# z80 Machine Code, 13 bytes
```
47 1F 1F 1F A8 E6 01 05 10 01 3D C6 30
```
Takes input (starting at 1) in the A register and stores output in the same register. This was manually assembled from the ez80 manual and is not yet tested, therefore it might contain some mistakes.
**Explanation:**
```
47        ld b, a         ; Copy the value to the B register
1F 1F 1F  rra   (3 times) ; \ Set A to ((A >> 3) ^ B) & 1, which is
A8        xor a, b        ; | equal to 1 on all months with 31 days
E6 01     and a, 1        ; / 
05        dec b           ; \ Decrement the B register twice and skip the next instruction if 
10 01     djnz $+3        ; / the resulting value is not zero (if the month is not february)
3D        dec a           ; Decrement A (if february)
C6 30     add a, 30       ; Add 30 to A
```
[Answer]
# [C++ (g++)](https://gcc.gnu.org/), ~~60~~ ~~54~~ ~~47~~ 40 bytes
1-indexed. f(2)==29.
```
int f(int n){return(n^n/8)%2-(n==2)+30;}
```
Solution from k-map, which simplified to A=w+x+z and B=zw'+z'w. A was negated and became a subtraction.
```
int f(int n){      //N is a 4-digit binary number wxyz.
return (n^n/8) %2  //Add 1 if (w XOR z)
     - (n==2)      //Subtract 1 if !(w OR x OR z), which simplifies to (w'x'z'),
                   //which is only satisfied when N is 0000 or 0010.
                   //Since n is never 0, this condition is only satisfied when n==2.
     + 30;         //Add 30, the base month length.
}
```
At first I tried adding 1 or 2 instead of 1 or 1, but my solution was 87 bytes (if I remember correctly). I tried that with 0-indexing and 1-indexing, but they ended up being the exact same length. 
47 bytes: `int f(int n){return(n/8|n/4|n)%2+(n^n/8)%2+29;}`
54 bytes: `int f(int n){return((n>>3|n>>2|n)&1)+((n^n>>3)&1)+29;}`
60 bytes: `int f(int n){return(n>>3&1|n>>2&1|n&1)+((n&1)^(n>>3&1))+29;}`
Edit: Thanks to Herman L. for the improvement to 54 bytes, I'm glad someone found my approach interesting even though it's clearly not the shortest!
Edit 2: Thank you to ceilingcat for the improvement to 47 bytes. This uses division instead of bit shifting, which saves one byte in each of three places. It also replaces `&1` with `%2` in two places. Both of these functionally return the last byte of the integer, but the modulo operator has precedence over addition. This means that two pairs of parentheses can be removed, saving four bytes. In total, by mixing arithmetic and bitwise operators, ceilingcat managed to improve the answer by seven bytes! 
Edit 3: Another improvement by ceilingcat brings it down six bytes by doing bitwise comparison with 13, `-!(n&13)`. Since this is only true in one case, simplified to an equality check.
[Answer]
# Javascript, 23 bytes
```
n=>15662007>>~-n*2&3|28
```
This is utilizing a binary map 15662007 which is
```
111011101111101110110111
11.10.11.10.11.11.10.11.10.11.01.11
 3. 2. 3. 2. 3. 3. 2. 3. 2. 3. 1. 3
```
You just add each item to 28 and see that it provides a proper mapping to each month.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 18 bytes
```
->n{31-n%7%2-2[n]}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6v2thQN0/VXNVI1yg6L7b2v6GRXklmbmpxdU1FTYFCdIVOWnRFLFAcAA "Ruby – Try It Online")
0-based, basically the same formula as Adam, adapted to ruby.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
```
%7Ḃ31__1⁼$
```
[Try it online!](https://tio.run/##y0rNyan8/1/V/OGOJmPD@HjDR417VP4bGj3cse1w@6OmNZH/AQ "Jelly – Try It Online")
Pretty much just a translation of Adám and Kevin Cruijssen's APL and 05ab1e answers, respectively. There's probably some way I could cut out the `$`.
[Answer]
# T-SQL 61 bytes
```
declare @ int set @=2print DAY(EOMONTH(DATEFROMPARTS(1,@,1)))
```
40 bytes if we put the input directly to the query:
```
print DAY(EOMONTH(DATEFROMPARTS(1,2,1)))
```
[Answer]
# [J](http://jsoftware.com/), 19 bytes
```
(31-0 2 0,#:330){~]
```
For fun, here's a J translation of Adam's APL answer (also 12 bytes):
```
31-1&=+2|7&|
```
Jonah's comment saves another 4 bytes, due to:
1. better use of J's hook: `({...)` instead of `(...{~])`
2. better choice of starting binary values, adjusting the arithmetic as necessary (`30+1 _1,...` rather than `31-0 2 0,...`):
```
| expr    | result               |
|---------|----------------------|
| 0,#:330 | 0 1 0 1 0 0 1 0 1 0  |
| #:693   | 1 0 1 0 1 1 0 1 0 1  |
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuo2CgYAXEunoKzkE@bv81jA11DRSMFAx0lK2MjQ00q@ti/2tycaUmZ@QrpCkYwBiGMIYRjJGpZ2j0HwA "J – Try It Online")
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), `-rr`, ~~17~~ ~~16~~ ~~14~~ 13 bytes
```
$:&1=-&7%2%-
```
[Try it online!](https://tio.run/##y05N/@@QZlij/F9exUrN0FZXzVzVSFX3/7FJh/Y7pB2b9N/wv25REQA "Keg – Try It Online")
Simply a port of Adams APL answer.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 10 8 bytes
0-indexed, February is 29.
```
C@."
񣈆"
```
[Try it online!](https://tio.run/##K6gsyfj/39lBT0lW/uPijjal//@NAQ "Pyth – Try It Online") TIO doesn't seem to like the UTF-8 conjoined character, but it works in the official interpreter. Consider TIO a glorified pastebin for this.
Previous version, 10 bytes:
```
C@."
Îï»
```
[Try it online!](https://tio.run/##K6gsyfj/39lBT0lGnvlw3@H1h3Yr/f9vCAA "Pyth – Try It Online")
[Answer]
# [Wren](https://github.com/munificent/wren), 27 bytes
-3 bytes thx to Jo King for putting all into a tertiary statement.
```
Fn.new{|x|1==x?28:31-x%7%2}
```
[Try it online!](https://tio.run/##Ky9KzftfllikkKhgq/DfLU8vL7W8uqaixtDWtsLeyMLK2FC3QtVc1aj2f3BlcUlqrl55UWZJqkaiXnJiTo6GgabmfwA "Wren – Try It Online")
# [Wren](https://github.com/munificent/wren), 35 bytes
-4 bytes thx 2 Jo King for noticing that `.bytes[x]` would work.
```
Fn.new{|x|" 




".bytes[x]}
```
[Try it online!](https://tio.run/##Ky9KzftfllikkKhgq/DfLU8vL7W8uqaiRklBXkZeDgjBhJJeUmVJanF0RWzt/@DK4pLUXL3yosySVI1EveTEnBwNI03N/wA "Wren – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 22 bytes
```
f(n){n=31-n%7%2-!~-n;}
```
[Try it online!](https://tio.run/##Fcg7DoQgEADQnlOwJCQzURI/xRazHsagmCmcNYgVYa/O6iufd5v3tQYQzDKNvRP7toN7/ZxQqSxJ7zOLBswqfCM8wVNH/OkH4qbBfMT7Ahi7mDYAI9JxpROMQSoqrumKojtSpf4B "C (gcc) – Try It Online")
Stealing from @Arnaulds / @Adám
---
~~29~~ [26 bytes](https://tio.run/##S9ZNT07@/z9No0KzusJWSV5GXg4IwYRSdEWsde3/zLwShdzEzDwFDc1qrrT8Ig2QQKatgXWmjaGRdaa2tmZ1QRFQLE1DSTVFSSdNI1NT07qgtKRYQ0lJ07qWqyi1pLQoT8HAmqv2PwA "C (gcc) – Try It Online")
```
f(x){x="




"[x];}
```
Port of @Embodiment of Ignorance answer
]