Rep-string: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add BQN) |
|||
Line 737: | Line 737: | ||
00 : 0 |
00 : 0 |
||
1 is not a rep-string</pre> |
1 is not a rep-string</pre> |
||
=={{header|BQN}}== |
|||
<lang bqn># Returns a list of all rep-strings |
|||
Reps←(⌊≠÷2˙)((⊣≥≠¨∘⊢)/⊢)(<≡¨≠⥊¨1↓↑)/1↓↑ |
|||
# Tests |
|||
tests←⟨ |
|||
"1001110011", "1110111011", "0010010010", |
|||
"1010101010", "1111111111", "0100101101", |
|||
"0100100", "101", "11", "00", "1" |
|||
⟩ |
|||
∾´{ 𝕩∾':'∾(•Fmt Reps 𝕩)∾@+10 }¨tests</lang> |
|||
{{out}} |
|||
<pre>"1001110011:⟨ ""10011"" ⟩ |
|||
1110111011:⟨ ""1110"" ⟩ |
|||
0010010010:⟨ ""001"" ⟩ |
|||
1010101010:⟨ ""10"" ""1010"" ⟩ |
|||
1111111111:⟨ ""1"" ""11"" ""111"" ""1111"" ""11111"" ⟩ |
|||
0100101101:⟨⟩ |
|||
0100100:⟨ ""010"" ⟩ |
|||
101:⟨⟩ |
|||
11:⟨ ""1"" ⟩ |
|||
00:⟨ ""0"" ⟩ |
|||
1:⟨⟩ |
|||
"</pre> |
|||
=={{header|C}}== |
=={{header|C}}== |