lambda n:reduce(int.__mul__,[2*i for i in range(1,n+1)if n%i<1])
lambda n:eval('*'.join(repr(2*i)for i in range(1,n+1)if n%i<1))
lambda n:eval('*'.join(`2*i`for i in range(1,n+1)if n%i<1))
lambda n:eval('*'.join(`(2*i)**(n%i<1)`for i in range(1,n+1)))
Chat mini challenge: Given a list of numbers, output an array containing each number N of the original list K times, K being a random integer between 0 and N. E.g., 3 4 5 can have 3 appearing 0, 1, 2, or 3 times.
> X 1 Random; choose a random item from z if z is a list, or from 1 to z inclusive if z is a positive integer. If z = 0, return z. Error if z is negative or a decimal.
code-golf
Directly from http://stackoverflow.com/q/37447114:
Challenge
Find the longest run of true in a list of booleans. Return the same list, with all other trues falsified.
Input
A list; any usual format.
Output
Same as input.
Details
If there's a tie for longest run, keep all tying ...
Squarefree decomposition code-golf
Given a positive integer n, output positive integers a and b so that
n = a^2 * b
with b squarefree, i.e. not divisible by any perfect square except 1.
Chat mini-challenge: given a mapping from the integers from 1 to N to the integers from 1 to N (represented by array), determine if the mapping is surjective, injective, bijective, or nothing.
you may choose any character/digit for the four outputs
format: n, arrays of pairs
for example, {i+1 | i from 1 to 9} (n=10) is represented by 10, [[1,2],[2,3],...,[9,10]]
@LeakyNun Logical and cannot short-circuit because it vectorizes. Even if it didn't, logical and would have to be a quick to have an effect on the right argument.
Given a mapping from the integers from 1 to N to the integers from 1 to N, determine if the mapping is surjective, injective, bijective, or nothing.
You may choose any character/digit for the four outputs.
Specs
Input format: n, arrays of pairs (n is the highest number in the domain and range)...