login
a(n) is the index of the binary string of a Post's Correspondence Problem Encoding with index n.
1

%I #28 Feb 22 2020 20:57:36

%S 1,2,3,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,13,13,14,14,14,

%T 14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,

%U 20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25

%N a(n) is the index of the binary string of a Post's Correspondence Problem Encoding with index n.

%C Listing all valid sequences of pairs ((x1, y1), (x2, y2), ...) with binary strings as values (including leading zeros!), so that each value has at least one digit, this sequence gives the index of the base binary string x1y1x2y2...

%C The binary strings are assumed to be ordered by (1) length and (2) numeric value, starting (for tuple validity) at length 2: 00, 01, 10, 11, 000, 001, ...

%C The structure of the sequence becomes clearer as you write all numbers having the same number of occurrences in one line:

%C 1, 2, 3, 4,

%C 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,

%C 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, ...,

%C 29, 29, 29, 29, 29, 29, 29, 29, 30, ...

%C This connection is an empirical observation.

%H Philip Höbler, <a href="/A309250/b309250.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 2^(b(n)+2) - 4 + ceiling((n - (4/3)*(4^b(n)-1)) / 2^b(n))

%F where b(n) = floor(log_4((3/4)*n + 1/4)).

%e The first 4 PCP encodings consist of two letters only (binary strings 00, 01, 10, 11). Therefore there is only one valid permutation to generate a PCP: [(first letter, second letter)]. Thus the sequence is a bijection between binary strings and PCPs for the first 4 terms, resulting in the numbers 1, 2, 3, 4. From PCP no. 5 on, the length of the binary string leaves room for permutation (e.g., 000 can be converted to PCPs [(0, 00)] or [(00, 0)]). Therefore, multiple PCP indices are mapped to the same binary string, resulting in the same number of occurrences in the sequence. PCPs no. 5 and 6 are mapped to binary index 5, PCPs no. 7 and 8 are mapped to binary index 6 and so on.

%e As the number of letters in a given PCP reaches 4, there are 4 possible permutations (e.g., [(0, 000)], [(00, 00)], [(000, 0)], [(0, 0), (0, 0)]), and the corresponding binary string indices occur 4 times in the sequence. For 5 letters, there are 8 possible permutations, and so on.

%o (Java)

%o public static long b(long index) {

%o return (long) (Math.log(((float) 3 / 4) * index + 1) / Math.log(4));

%o }

%o public static long a(long index) {

%o index--;

%o long l = b(index);

%o long binIndex = (long) Math.pow(2, l + 2) - 4;

%o binIndex += (index - (long) (((float) 4/3) * ((Math.pow(4, l) - 1)))) / Math.pow(2, l);

%o return binIndex + 1;

%o }

%o (PARI) b(n) = floor(log((3/4) * n + 1)/log(4));

%o a(n) = 2^(b(n)+2)-4 + floor( (n - 1 - (4/3) * (4^b(n) - 1)) / 2^b(n) ) + 1; \\ _Michel Marcus_, Jul 20 2019

%K nonn

%O 1,2

%A _Philip Höbler_, Jul 18 2019