find the pattern in this number sequence of 1's and 0's
Jelly, 11 10 bytes
Saved 1 byte thanks to @Dennis
ȷḶ×⁽q£:ȷ5Ḃ
Try it online!
How?
I first noticed that the pattern alternates between runs of length 4 and length 3, skipping the length-4 step every few runs. This led me to look for a number which could be divided into the current index, then taken mod 2 and floored—i.e. retrieving the least significant bit—to give the bit at that index in the series. After much trial and error, I found that 3.41845
does exactly that, but multiplying by its approximate reciprocal (.29253
) is a byte shorter.
ȷḶ×⁽q£:ȷ5Ḃ Main link. Arguments: none
ȷ Yield 1e3, i.e. 1000.
Ḷ Lowered range; yield [0, 1, 2, ..., 999].
×⁽q£ Multiply each item by 29253.
:ȷ5 Floor-divide each item by 1e5, i.e. 100000.
Ḃ Take each item mod 2.
Dyalog APL, 99 83 82 bytes
a←{⍵/0 1}¨(↓3 2⍴4 3 3)
{a⊢←↓⍉↑a{⍺∘{⍵/⊂⍺}¨⍵}¨↓3 3⍴⍵}¨(9/5)∘⊤¨1386531 496098
1000⍴∊a
Try it online!
Definitely not the intended solution as this still has a lot of hardcoded data, but it's a start.
Ruby, 34 29 26 22 bytes
$.+=184while p$./629%2
Try it online!
Quick explanation: this works because of the magic number 629. I noticed that the sequence starts repeating after the 629th element, and I tried to "improve" some existing answer, using only integer math. I found that the other "magic number" (0.29253) is actually 184/629.