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 |
A competition to solve a particular problem through the usage and manipulation of numbers.
3
votes
Evaluate the primorial of a number
Mathematica, 27 chars
Times@@Prime@Range@PrimePi@
Usage
Times@@Prime@Range@PrimePi@100
(*
2305567963945518424753102147331756070
*)
4
votes
Compute the number of ways how you can express a number as a sum
Mathematica 25 11
PartitionsP
Usage
PartitionsP[4]
(*
5
*)
Calculating the result for n = 1000 is instantaneous
Timing[PartitionsP@1000]
(*
{0., 24061467864032622473692149727991}
*)
1
vote
Machine Epsilon
Mathematica 15 chars
$MachineEpsilon
-> 2.220446049250313*10^-16
2
votes
Arbitrary Base Conversion
Mathematica
No variables defined, any input accepted as long as it fits in memory.
f[i_, sb_, db_] := IntegerDigits[FromDigits[i, sb], db];
Test drive:
f[{1,2,3,4},16,16]
f[{1,0},10,100]
f[{41, …
11
votes
Output nearby primes
Mathematica: 28 chars
(k=NextPrime;{k[#,-1],k@#})&
Usage
%[1259]
{1249, 1277}
%[121231313159]
{121231313129, 121231313191}
3
votes
Perfect powers in more than one way?
Mathematica: 103 chars
Spaces can be removed
Select[Flatten@
Table[
Solve[Log@#/Log@b == k, k, Integers] /. k -> #, {b, 2, #}] & /@ Range@#,
Length@# > 2 &][[All, 1, 1]] &
Us …