Challenge
For any string that is composed of lower cased alphabetical characters, make a function that returns a list of all of it's variations, empty strings returns empty list.
Test Cases
"" -> []
"a" -> ['a', 'A']
"ab" -> ['ab', 'Ab', 'aB', 'AB', 'ba', 'Ba', 'bA', 'BA']
"abc" -> ['abc', 'A...
Introduction
There are lots of challenges asking for a shortest program to calculate mathematical constants. I saw some with restrictions like banning the literals 3.14 and PI etc. However, there seems no such challenges using the number of distinct characters as one of the criteria.
The Challe...
I call this sequence "the Jesus sequence", because it is the sum of mod.</pun>
For this sequence, you take all the positive integers m less than the input n, and take the sum of n modulo each m. In other words:
For example, take the term 14:
14 % 1 = 0
14 % 2 = 0
14 % 3 = 2
14 % 4 = 2
14 % 5...
@LuisMendo Hm... initially I think that it will time out on TIO is good enough, but on another thought the languages which time-out on TIO is likely candidates. It's even harder to write a program that execute for a long time for most languages on TIO...
Also, be nice to TIO. Testing all 400 languages there with a computer script will make TIO busy.
@cairdcoinheringaahing I'm not sure if a 5 minute time limit is enough to prevent brute-force attempts. Since it's open source and the setup process is mostly automated, anyone can set up their own copy of TIO without time limits. The vast majority of languages should throw an error way before that time limit, so even testing all 400 languages shouldn't take too long.
But the real problem is, "It's even harder to write a program that execute for a long time for most languages", because if it terminates & produce wrong result for 399 languages, the remaining one is (probably) the answer.
@Dennis Well, preventing brute-force attempts is impossible; what we're trying to do is discourage them. If somebody's willing to spin up their own copy of TIO to help with a CnR question, then kudos to them, and I'll start polyglotting like mad and/or looking for languages that aren't on TIO.
I wrote a challenge about sampling a probability distribution: Sample the Pareto Distribution
This probability distribution is defined over the real numbers. However, submissions do not have access to true real numbers, but merely imprecise approximations of real numbers. I wanted to allow submi...
Unary numbers typically only represent nonnegative integers, but we can extend them to represent all integers as follows:
A positive integer N is represented as N 1's: 5 -> 11111
A negative integer -N is represented as a 0 followed by N 1's: -5 -> 011111
Zero is represented as 0
We can then r...
CMC: Implement hyperoperators, which is a function h(a,x,b) where h(a,x+1,b) denotes b nested a=h(a,x,a)s, and h(a,0,b) is a+1. As examples: h(a,1,b) is a+b, h(a,2,b) is a*b [a added to itself b times], h(a,3,b) is a**b.
@StevenH. Your definition isn't consistent. a+b is a incremented b times, while a*b is a times a a-1 times. If you applied the function a times, you'd get a * (a*a) = a*(a+1)
In mathematics, the hyperoperation sequence is an infinite sequence of arithmetic operations (called hyperoperations) that starts with the unary operation of successor (n = 0), then continues with the binary operations of addition (n = 1), multiplication (n = 2), and exponentiation (n = 3), after which the sequence proceeds with further binary operations extending beyond exponentiation, using right-associativity. For the operations beyond exponentiation, the nth member of this sequence is named by Reuben Goodstein after the Greek prefix of n suffixed with -ation (such as tetration (n = 4), pentation...
@StevenH. Tried to implement in tinylisp. For some reason, x=2 gave exponentiation instead of multiplication. Tried different things without success. Finally came to the conclusion that I really should have been in bed 2 hours ago. Thank you and good night. :P
In the first challenge answer posters have to obfuscate the code itself, now they also need to make sure it runs for a long time for some/most other languages on TIO.
Given a nonnegative integer, return whether it is a three digit number ending in one, in any consistent integer base. In other words, the number needs to be represented in base-N, N being an integer greater than zero.
Rules
This is code-golf, so shortest answer wins.
Since unary behaves weirdl...
I am new to Python. I am getting indentation error whenever i run my script.
The error looks like this
$python main.py
File "main.py", line 181
audior = pyaudio.PyAudio()
^
IndentationError: unexpected indent
Here's that part of my script where the error is being encountered
def onO...
I thought it was a common abbreviation around here for "Q&A website in The Stack Exchange Network and / or the community associated with the aforementioned website."
I do understand what it is, but I don't understand why does a site would opt out of Winter Bash. The "I hate hats" is supposed to be for individual users.
@wizzwizz4 I once had to idea to make an own private wiki-style ressource for myself, for stuff like that. But didn't end up doing it because I couldn't find a good software that suits my needs
Given a fraction in the format m/n (where m and n are coprime integers), output the corresponding unicode fraction. You will not be expected to allow any input that does not correspond to a unicode character. Arrays, e.g. [2, 3] as opposed to 2/3, are accepted. m / n as opposed to m/n is also fin...
@wizzwizz4 So? Their profile says they were suspended because of voting irregularities, and people lost rep, so we know that socks were created and deleted.
So... someone (let's say A) create secondary account (B) to vote irregularly, and now B is deleted (all votes of B are reversed) and A is suspended. Right?
On a related note, After being suspended I realised that was the most stupid thing I ever did (in August IIRC) I literally lost precious time with which I could have earned more
@user202729 In august, I have been suspended for voting irregularities (how stupid right???), resulting in -300 or something, but during the summer, I usually earned > 500 rep each week, so I lost more than I gained
I agree with Xcoder. Getting suspended is bad for two reasons: 1) It negatively affects the site as a whole (as shown by the rep losses we were complaining about) 2) You don't get the chance to contribute positively to site (correctly, or course), but you're just disadvantaging yourself.
According to this a truthy/falsy value has to be evaluatable (is that a word?) as a boolean, is that right? If I had a function that returns two values either X or Y and none of them are evaluatable as a boolean variable, I can't just define truthy as X and falsy as Y for the purpose of that answer or can I?
Given a nonnegative integer, return whether it is a three digit number ending in one, in any consistent integer base. In other words, the number needs to be represented in base-N, N being an integer greater than zero.
Rules
This is code-golf, so shortest answer wins.
Since unary behaves weirdl...
@Dennis: Not sure about the rules in the mentioned challenge, if you can return [] as falsy and [1] as truthy you can save a byte in your Haskell answer by doing [1|k<-[2..n],k^2<n,n<k^3,mod n k==1]
@cairdcoinheringaahing Yeah, very not ASCII compatible. I organized the code page based upon the function of the commands, along with assigning a character that represents the command ... thus, 0 through 9 are actually 0 through 9.
@Dennis: Yes, Haskell is pretty strict about that (which is good). I thought maybe it's possible to redefine true/false for the purpose of that challenge
I think I saw this done before, but I'm not too sure about it
@cairdcoinheringaahing husk is good for longer challenges, but often sucks for trivial ones (while it might be 5% shorter than Jelly for harder challenges, it is often at least 15% to 30% longer for trivial challenges - i.e. if the challenge involves vectorization and/or mapping dyadic commands)
You can get Python to print it all out iff you redirect to a file.
Iirc.
Testing it now.
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
print("".join(map(chr,range(8**6))))
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 65536-65536: Non-BMP character not supported in Tk
@Dennis It looks like it's an error upon printing.
And I've done this before.
Well, it doesn't work in 'UTF-8' either... but it will work in something.
@Mr.Xcoder what makes Gaia unique? I know that it drew inspiration from Jelly and Ohm (!), among other things, but I don't really know what else it added