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
Convert 1 into any positive integer using only the operations *3 and /2
Python, score 121 (87 - 2 + 36)
t=bin(41)
l,n,f=len(t),1,0
while bin(n)[:l]!=t:f+=1;n*=3
print(len(bin(n))-l)*'g'+f*'f'
2
votes
Reverse Polish notation
Python, 130 characters
Would be 124 characters if we dropped b and (which some of the Python answers are missing). And it incorporates 42!
s=[]
for x in raw_input().split():
try:s=[float(x)]+s
exc …
0
votes
Golfing: How many unit-length squares in a list of 2d coordinates?
Python, 61 chars
f=lambda l:sum(1for x,y in l if{(x+1,y),(x,y+1),(x+1,y+1)}<l)
Sample:
>>> f({(0,0), (0,1), (1,1), (1,0), (0,2), (1,2)})
2
>>> f({(0,0), (0,1), (1,1), (1,0), (0,2), (1,2), (2,2), ( …