Skip to main content
added 22 characters in body
Source Link
l4m2
  • 28.5k
  • 12
  • 14

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc.) is enough, even for more complex mapping.

Given an array \$\left[x_1,x_2,x_3,...,x_n\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 < k \le n, a \mod \left(bk+c\right) = x_k\$.

Fastest algorithm wins. Here word RAM model is used: bitwidth is by default \$\text O \left (\log \max\left\{ x_k, n\right\} \right)\$. You can cost \$2^t\$ time to extend the bitwidth to \$\text O\left(t\right)\$ without extra code. BigInts are treated as multiple ints, and take longer time to process larger values.

Sandbox Notes:

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc.) is enough, even for more complex mapping.

Given an array \$\left[x_1,x_2,x_3,...,x_n\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 < k \le n, a \mod \left(bk+c\right) = x_k\$.

Fastest algorithm wins. Here word RAM model is used: bitwidth is by default \$\text O \left (\log \max\left\{ x_k, n\right\} \right)\$. You can cost \$2^t\$ time to extend the bitwidth to \$\text O\left(t\right)\$ without extra code. BigInts are treated as multiple ints, and take longer time to process larger values.

Sandbox Notes:

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc.) is enough, even for more complex mapping.

Given an array \$\left[x_1,x_2,x_3,...,x_n\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 < k \le n, a \mod \left(bk+c\right) = x_k\$.

Fastest algorithm wins. Here word RAM model is used: bitwidth is by default \$\text O \left (\log \max\left\{ x_k, n\right\} \right)\$. You can cost \$2^t\$ time to extend the bitwidth to \$\text O\left(t\right)\$ without extra code. BigInts are treated as multiple ints, and take longer time to process larger values.

Sandbox Notes:

added 318 characters in body
Source Link
l4m2
  • 28.5k
  • 12
  • 14

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc.) is enough, even for more complex mapping.

Given an array \$\left[x_0,x_1,x_2,...,x_{n-1}\right]\$\$\left[x_1,x_2,x_3,...,x_n\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 \le k < n, a \mod \left(bk+c\right) = x_k\$\$ \forall 0 < k \le n, a \mod \left(bk+c\right) = x_k\$.

Fastest algorithm wins. Here word RAM model is used: bitwidth is by default \$\text O \left (\log \max\left\{ x_k, n\right\} \right)\$. You can cost \$2^t\$ time to extend the bitwidth to \$\text O\left(t\right)\$ without extra code. BigInts are treated as multiple ints, and take longer time to process larger values.

Sandbox Notes:

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc) is enough, even for more complex mapping.

Given an array \$\left[x_0,x_1,x_2,...,x_{n-1}\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 \le k < n, a \mod \left(bk+c\right) = x_k\$.

Sandbox Notes:

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc.) is enough, even for more complex mapping.

Given an array \$\left[x_1,x_2,x_3,...,x_n\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 < k \le n, a \mod \left(bk+c\right) = x_k\$.

Fastest algorithm wins. Here word RAM model is used: bitwidth is by default \$\text O \left (\log \max\left\{ x_k, n\right\} \right)\$. You can cost \$2^t\$ time to extend the bitwidth to \$\text O\left(t\right)\$ without extra code. BigInts are treated as multiple ints, and take longer time to process larger values.

Sandbox Notes:

added 329 characters in body
Source Link
l4m2
  • 28.5k
  • 12
  • 14

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc) is enough, even for more complex mapping.

Given an array \$\left[x_0,x_1,x_2,...,x_{n-1}\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 \le k < n, a \mod \left(bk+c\right) = x_k\$.

Sandbo xNotesSandbox Notes:

Given an array \$\left[x_0,x_1,x_2,...,x_{n-1}\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 \le k < n, a \mod \left(bk+c\right) = x_k\$.

Sandbo xNotes:

Tableing in 3 operations

There was a puzzle requiring to convert EBCDIC into ASCII in 4 operations. Actually, if big integers are allowed, 3 mathematical operations(so no bit shift, integer division, etc) is enough, even for more complex mapping.

Given an array \$\left[x_0,x_1,x_2,...,x_{n-1}\right]\$, generate arguments \$a,b,c\$, such that \$ \forall 0 \le k < n, a \mod \left(bk+c\right) = x_k\$.

Sandbox Notes:

Source Link
l4m2
  • 28.5k
  • 12
  • 14
Loading