Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
The challenge involves mathematics in some central way. Also consider using more specific tags, listed in the tag wiki info.
3
votes
Fastest count of certain hypercubes with labeled vertices
Python + python-sat (about 1 second on my machine)
import itertools
from pysat.solvers import Glucose4
def count_cubes(n):
clauses = []
for (x, y, z) in itertools.combinations(range(1 << n), …
2
votes
f(g(x)) decreases while g(f(x)) increases
Pyth, 34 Bytes
This is just a direct translation of my Python answer.
*-1*2%Q2+*2*QQ<Q0
*-1*2%Q2+*2*QQ>Q0
1
vote
Compute a complex power
Pyth, 16 Bytes
=b^Q-Q.j;eS,ebsb
20
votes
f(g(x)) decreases while g(f(x)) increases
Python, 68 characters
f=lambda x:(1-x%2*2)*(2*x*x+(x<0))
g=lambda x:(1-x%2*2)*(2*x*x+(x>0))
f maps negative numbers to odd numbers and positive numbers to even numbers, and even numbers to positive n …