People keep telling me that the square of a number is the number multiplied by itself. This is obviously false. The correct way to square a number is to make it into a square, by stacking it on top of itself a number of times equal to its length, and then reading all the numbers from the result...
an interesting problem, for a given size of n, how many pairs of multisets of positive integers are there such that sum(a) = prod(b) and sum(b) = prod(a)
@EriktheOutgolfer Coincidentally, the question I'm editing is the very reason I requested 65536 chars, but I didn't end up using them because it's still 30000 on meta so I couldn't test it before posting, so I went with a different approach
I only had to golf because I didn't want the list of links to spill over onto 2 lines
@EriktheOutgolfer As long as it's on one line with a bit of extra space under the standard viewing conditions, I'm happy. I accept I can't cover everything
Feels good when you see an answer in your language by someone you didn't even know was learning it. Makes me think my docs aren't actually completely awful
Brachylog, 6 bytes
{p.↔}ᵘ
Try it online!
Explanation
{p.↔}ᵘ
{ }ᵘ find all unique...
p permutations of the input...
.↔ that are palindromes (i.e. equal to itself reversed)
When we enter an URL in a browser, it uses HTTP by default but if the server only support HTTPS, does the traffic redirect to https automatically without the user noticing?
Am I right?
If wrong, please correct me.
The nice angles trig-based function
Everybody knows what are the degrees nice angles we can see on the trigonometric circle.
The task is you have to write a function which generates the second column outputs based on the inputs of the first column:
But rules need to be followed:
No complex...
Quesiton: is it better to store a user's followers or who they are following. It seem better semantically to put following also significantly simplifies deletion but then to find followers that is much more difficult because now I have to look through whole DB again
@Downgoat I suggest both. It's better to update two values every time someone follows someone than have to look through the whole database each time you want to get the values in the direction you didn't store.
@HyperNeutrino not really as unless I get a database that guaranteed synchronization in a concurrent environment having a dependency on two sync'd fields.
The nice angles trig-based function code-golf
Everybody knows what are the degrees nice angles we can see on the trigonometric circle.
The task is: You have to write a function which generates the second column outputs based on the inputs of the first column:
But rules need to be followed:
...
@sergiol also you haven't described the sequence in your question and the entire examples are on the image. You should 1) not describe challenge solely in terms of I/O unless kolmogorov-complexity which it seems like this challenge is 2) if you really want to continue as so, it would help to ascii-art the graph in a more friendly format.
@WheatWizard your arguments against pop-cons are really good. I keep on thinking about both sides, and I can understand both sides. I can't decide which one I like better
@sergiol ok so if you are doing 'nice angles' then it's a kolmogorov-complexity challenge also is like 59.999999999 ok for 60 because many language will have minor imprecision
@sergiol is functional .map considered a control structure, JS lang does not officially consider it a control structure but it can be considered one.
what about recursion since I can use that to simulate control structure
@NathanMerrill Thanks. I find it pretty easy myself because of a general distain for the format, but I think this is the question for the community right now. I have my opinions but I can see how this is a difficult thing for the community to decide on.
Can any body tell me how to create a 2 dimensional array in python? I saw a few questions already asked on stack overflow but I couldnt get a few help.
Proposed Question
Triskaidekaphobic Primes
It is known that a certain number, which lies between 12 and 14, brings bad luck. The Church of Triskaidekaphobia (CoTDP) asserts that the key to salvation is avoiding this number in all situations, such as numbering floors, license plates, space shutt...
C# supports both true multi-dimensional arrays, and "jagged" arrays (array of arrays) which can be a replacement.
// jagged array
string[][] jagged = new string[12][7];
// multidimensional array
string[,] multi = new string[12,7];
Jagged arrays are generally considered better since they can ...
I'm here from PPCG addressing the competition to which Christopher from PPCG challenged you, CR, yesterday.
Some concern was voiced by a few trusted users of this community, and I'd like to continue the discussion more specifically based on what they're saying.
I understand that incidents in th...
Inspired by Create a binary wall
Given a list of positive integers, we can write them out all above each other like so, for [2, 6, 9, 4] as an example:
0010
0110
1001
0100
We can imagine this as a wall:
..#.
.##.
#..#
.#..
However, this is a very weak wall, and it has collapsed! Each 1 (#)...
@StepHen % => take the square root of each element of an array and perform cumulative addition, then fill it into a matrix while randomising the elements, after which each row is reduced by LCM into an array, and consecutive elements get bitwise XOR performed to each other, and then you do mixed base conversion of the resulting array with itself
@Phoenix I could do that, hm. Although it'd be just as long as root/square root since my operators I have are two bytes. Are there any really obscure, occasionally useful operators that don't make sense as functions (like bitwise)
(that is, until I open up to unicode and start doing SBCS)
Background:
There was a google code challenge or something like that a coworker and I wrote a while back. I can't find it anymore but it was kind of fun. I couldn't find it with a search on this site so I thought it'd be fun to bring it here.
Story
There is a woman, named Sarah, whom likes s...
https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax
tl;dr:
Must begin with http:// or https://
Should detect subdomains
Characters a-z, digits 0-9
Cannot start nor end with a hyphen (-)
Cannot have a hyphen in third and fourth position, unless the first two characters are 'xn'
...
So, when I'm doing string functions (reverse, rotate, etc.) on numbers, should I ignore - and .? Is there ever a time when you wouldn't want . especially to be ignored? Should I include that as an option?
You are given a grid of size n x n filled with numbers in each of its cells. Now you need to count total cells in the grid such that the sum of the numbers on its top , left , right and bottom cells is a prime number. In case there is no cell in a particular direction assume the number to be as 0...