about summary refs log tree commit diff
path: root/daily/305easy/README.md
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-03-14 10:23:43 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-03-14 10:23:43 +0700
commit69a50f40bea8f04c2d2b1715dad5ea8c7d6ef507 (patch)
treef51905a868a94fa6eac79f5a6d6ec5aceb139f42 /daily/305easy/README.md
parent2468c60b00b200b24a383ecc0fdc5d3cf8721b9f (diff)
downloadcp-69a50f40bea8f04c2d2b1715dad5ea8c7d6ef507.tar.gz
Add /r/dailyprogrammer Challenge #305
Diffstat (limited to 'daily/305easy/README.md')
-rw-r--r--daily/305easy/README.md50
1 files changed, 50 insertions, 0 deletions
diff --git a/daily/305easy/README.md b/daily/305easy/README.md
new file mode 100644
index 0000000..0f8876b
--- /dev/null
+++ b/daily/305easy/README.md
@@ -0,0 +1,50 @@
+# [[2017-03-06] Challenge #305 [Easy] Permutation base](https://www.reddit.com/r/dailyprogrammer/comments/5xu7sz/20170306_challenge_305_easy_permutation_base/)
+
+There may be an actual name to this base system (let us/me know in comments),
+and there is a math insight that makes this problem even easier, but it is
+still pretty easy with no math insight.
+
+For *permutation base 2*, the indexes and values start with:
+
+| index | value |
+| :---: | ----: |
+|   0   |    0  |
+|   1   |    1  |
+|   2   |   00  |
+|   3   |   01  |
+|   4   |   10  |
+|   5   |   11  |
+|   6   |  000  |
+|   7   |  001  |
+|   8   |  010  |
+|   9   |  011  |
+
+## Sample challenge
+
+What is the base-value for index `54`?
+
+What is the index-value for base `111000111`?
+
+## Example
+
+    permbase2 54
+    1 1 0 0 0
+
+    permbase2 inv 1 1 1 0 0 0 1 1 1
+    965
+
+## Challenge index inputs (some are 64-bit+ inputs)
+
+    234234234
+    234234234234234
+    234234234234234234234234
+
+## Challenge value inputs
+
+    000111000111111000111111000111111000111
+    11111111000111000111111000111111000111111000111
+
+## Bonus
+
+Extend the function to work with any base. Base 10 index value `10` is `00`.
+Index value `109` is `99`