CMC: Given a list of numbers n :: [Int] and function f :: Int -> Int -> Int, for each value i in n, for each value j other than i in n, get the result f i j. You should end up with a result that's a list of lists of ints, Example: for n = [1, 2, 3, 4] and f = (*), the result would be [[2, 3, 4], [2, 6, 8], [3, 6, 12], [4, 8, 12]]
Is it a Hamiltonian cycle on a grid?
A Hamiltonian path in a graph is a path that visits each vertex exactly once; a Hamiltonian cycle is a Hamiltonian path that is a cycle – the path forms a simple closed loop. In this challenge the graph will be a n x n grid, where n is an even number greater ...
This challenge is inspired by my earlier challenge "Create a program that prints the amount of characters it has, in words".
This challenge's rules are simple: make a program that prints its character count, in words, which works in as many languages as possible.
Each programming language the p...
I'm surprised this hasn't been done yet, but here we go.
Create a program which prints some number of 1s (ideally as large as possible) before halting.
The rules are simple:
Your program is bounded to 50 bytes in size.
Your output must only be a row of 1s (plus trailing newline if it has to b...
This is a simple challenge: given n in any way practical (Function arg, stdin, file, constant in code) output the internal angles of a polygon with n sides.
Standard loopholes are allowed but only if they are creative/funny. Please don't do things that have been done to death.
As usual, smalles...
If each factor comes from a different number, what options are there? If they come from the same number, what options are there now?
now, writing code that does that kind of deductions isn't as easy as doing them oneself, but it does help prune quite a few numbers. I'd start by iterating over the multiples of the largest factor.
We have tons of hello world challenges here. Here's a simple one with a twist: print hello world with the longest code possible.
Rules
All code must be executed.
The code cannot have any comments.
It must print hello world in all lowercase with one space and no punctuation. It cannot print any...
External third-party user receives an external third-party email from someone@notremotelylikeourname.com with spelling mistakes and order numbers that don't match our system. User clicks link in the email and enters credentials, then (several days later) complains to us because she got phished. Her excuse? The email "had our logo in it" so it looked legit.
Only if it's absolutely OK. We usually survive well enough without ETH when he's not around for a while. Although this has been a longer "while" than usual.
I was doing some investigation into trig functions using compound angles recently, and noticed that the results are really long and tedious to write:
$$
cos(A+B) = cosAcosB - sinAsinB\\
cos(A-B) = cosAcosB + sinAsinB\\
sin(A+B) = sinAcosB + sinBcosA\\
sin(A-B) = sinAcosB - sinBcosA\\
$$
$$
tan(A+...
I have been using functions for Zsh submissions for some time. I typically submit the body alone, as the body can be run as a full program with no modification: afunction arg1 arg2 vs ./aprogram arg1 arg2. If recursion is needed, $0 can be used.
I saw this recent challenge, which is a purely mat...