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.
6
votes
Count sum of all digits
Husk, 4 bytes
Σṁdḣ
Try it online!
ḣ makes a range from 1 to input
ṁd flatmap digits
Σ sum
2
votes
Count sum of all digits
Pyth, 6 bytes
ssMjkS
Try it online!
S create range from 1 to input
jk join on k (initially empty string)
sM map to number
s sum
6
votes
Iterate your way to a fraction
Ruby, 45 bytes
f=->n,d{n==0?"":n/d<0??g+f[-d,n]:?f+f[n-d,d]}
Try it online!
Use as f[n,d]
basically a port of loopy walt's python answer
1
vote
Approximate Brun's Constant
Husk, 14 bytes
ṁ\Σfo=2F-Ẋefṗŀ
Try it online!
Explanation
ṁ\Σfo=2F-Ẋefṗŀ
ŀ lowered range, 0..n-1
fṗ filter primes
Ẋe get each consecutive pair
f F- …