@phase If you have a function/verb f, you can apply its inverse with f^:_1 in J. For example, since #: is convert from integer to base 2, #:^:_1 is convert from base 2 to integer.
J, 31 30 24 23 bytes
(e.>./,<./@#~)@(+/)&.#:
This is a tacit, monadic verb that takes a list of decimal integers and returns their decimal biplex.
Thanks to @Zgarb for his suggestions, which saved 4 bytes directly and paved the way for 2 more!
Test cases
biplex =: (e.>./,<./@#~)@(+/)&.#:...
I'm using dual (&.), which applies a function, then another function, then the inverse of the first. Perfect for convert to base 2, do stuff, convert back to base 10.
For a more impressive use of J's function inversion, see this:
J - 17 char
g=:(f=:_ q:>:)inv
We implement the prime exponent idea with this bijection—that's what the _ q: is doing, getting a list of the exponents of the primes of a number—except we also increment the input number by one before doing so, with >:, so that we don't forget 0, who doesn't have...
You should have received a copy of the GNU General Public License
along with this program. If not, write to
The Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
do the people who wrote the GPU really expect people to do that?
> who are you? Searching for yourself can take a lifetime, but a good place to start is classic rock (along with link to https://www.youtube.com/watch?v=PdLIerfXuZ4)
On that note, I'm off. Don't do anything I wouldn't do (this includes ASCII art).
Julia, 57 bytes + 25 errors = 82
k->(V=var(k))>1/6?"E":V>0.1?"B":V<.05?"T":any(k.>1)?"G":"U"
k->(V=var(k))>0.14?"E":V>0.1?"B":V<.05?"T":any(k.>1)?"G":"U"
This is fairly simple. The variance for the distributions are mostly different - it's 1/4 for exponential, 1/8 for beta, 1/12 for gamma and ...
I tried variance (stdev, but whatever), but I got awful results. It could be related to the revised test cases, but my biggest mistake was to not combine it with the has-elements-greater-than-1 test.
But with the new money laundering laws passed recently here in Germany most retailers have to switch to a standardized (expensive) new type of register. It is supposed to be "hacking" proof (insert evil laughter here)
@mınxomaτ Yeah, my employer has had to make some upgrades in the past few years to comply with US credit card laws... not my area, though, so I don't know much more than that.
@DLosc Basically there can be surprise visits from the tax authorities and they have an ID card with a private key on it so only they can access the cash log files.
The system is already hacked and it's not even out yet.
Booted up an old computer after taking out an unnecessary video card. Windows XP. Wow, reminds me of the days when Windows 95/98 was the common old Windows OS. :P
@Lembik i thought for strange coins that your description is clear and unambiguous, but then i read the comments with mbomb007 and then it needs clarification
because of your reply to him
you wrote x_0 in your comment, which is confusing -- makes it sound like you can choose an arbitrary new coin to start weighing, and not just coin 0
since from problem description it seems clear that {x_i} is just arbitrary collection of indices, and the i doesn't give the coin's label, as mbomb007 seemed to interpret it
QPaysTaxes was maybe confused about this too, since he mentioned about "a through b", although your description doesn't imply that the chosen coins have to have consecutive labels, as far as i can see
maybe best way to avoid confusion is to give short example, e.g. first weighing is (x_1, x_2, x_3) = (3, 2, 7), then second weighing can be either (4, 3, 8) or (0, 4, 3, 8)
i guess it could be clarified: if we choose second weighing (0, 4, 3, 8), then third weighing can be either (1, 5, 4, 9) or (0, 1, 5, 4, 9) ?
the other option is (5, 4, 9) vs (0, 5, 4, 9)
@Lembik ^
it seems the chat message time stamps are at a resolution of 1 minute only?
i guess a finer resolution isn't useful for most things and just uses server space, but there is a little odd interaction above, where my message and Lembik's were within a second of each other, and "crossed in the mail"
Create a program, that outputs a hello world string ("Hello world", "Hello, World" etc.), and source code. Output is written to stdout or equivalent. Hello world string is embedded in the source code.
For example, the output for might be
(some source code here)hello world(some source code here)...
Literally Mirror Your Sourcecode!
Task
Your program should take input.
If the input is falsy, print the source code.
If the input is truthy, print the mirrored source code.
What is mirrored in my opinion (That is used in this challenge)?
Each line is padded with space so each line have sa...
3var is a variant of deadfish which uses three variables called A, B and R.
A and B are accumulators, while R is used as a result variable.
In this code-golf challenge, you need to make an interpreter for a stripped-down version of this language.
Required Commands:
i Increments A
d Decre...
Print a sourcecode
Task:
code-golfquine
Given 2 inputs(First input is truthy/falsy, second input is program in same language as submission):
If the first input is truthy then transform the second input into same program but printing the source code(After modification) first.
If the first inp...