
A121016: Numbers whose binary expansion is properly periodic. or ...
Mar 12, 2025 · This task is similar to deciding whether a given binary integer is represented by a regular expression ([01]+)\1+ but I could not find the exactly matching sequence registered at …
The Binary Binary Expansion - Code Golf Stack Exchange
Aug 31, 2017 · The choice of 0 and 1 is... not very binary. We shall perform the true binary expansion by expanding with powers of 2, but with a coefficient of 1 or -1 instead: 25 = 1*16 + …
Binary Expansion Counting Sequence - Code Golf Stack Exchange
Jan 19, 2024 · The binary expansion sequence is defines as follows, assuming 0 indexing: The even numbers of the sequence are how often 0 has appeared in the binary expansion of all …
Find a sequence in the binary digits of π
Jan 4, 2021 · This gives the binary expansion with n digits G % Push input Xf % Index of ocurrences of the input. May be empty t % Duplicate n~ % Number of elements, negate. This …
Maximum number of trailing zeros - Code Golf Stack Exchange
Apr 12, 2024 · The maximum number of trailing zeros in the binary expansion of any integer in the interval [a .. b]. Examples. Input: [17 .. 21] ; Output: 2 ; since 20 corresponds to 10100. Input: …
Number of distinct non-empty subsequences of binary expansion
Oct 15, 2017 · Write a program or function that given a positive integer n returns the number of distinct non-empty subsequences of the binary expansion of n. Example: since 4 is 100 in …
code golf - Decide symmetry of fractions - Code Golf Stack …
Oct 8, 2024 · Given a nonnegative fraction whose denominator is a power of 2, decide whether its (finite-length) binary expansion is symmetric by the radix point. I/O format. It is assumed that …
code golf - Cantor Function, Cruel - Code Golf Stack Exchange
Jul 24, 2020 · Ternary expansion. To ternary expand p/q, we divide 3p by q, resulting in the quotient d and remainder r. d is the next ternary digit. To get the digits after that, we simply …
Binary expansion and partition numbers - Code Golf Stack Exchange
Oct 12, 2023 · To reproduce the sequence a(n) through itself, use the following rule: if binary 1xyz is a term then so are 110xyz and 1XYZ where the last one is the same as 1xyz with rewrite 1 …
Generate m-sequences - Code Golf Stack Exchange
Mar 21, 2016 · Binary array. In this case L is not explicitly given, because it is the length of the vector. You can choose to include a dummy leading 1 in the above array (and then L is the …