From 69a50f40bea8f04c2d2b1715dad5ea8c7d6ef507 Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Tue, 14 Mar 2017 10:23:43 +0700 Subject: Add /r/dailyprogrammer Challenge #305 --- daily/305easy/README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 daily/305easy/README.md (limited to 'daily/305easy/README.md') 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` -- cgit 1.4.1