Skip to main content
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
Results for mathematica tagged with
Search options not deleted not community wiki user 8478

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

75 votes

"Hello, World!"

I have started setting up a solver in Mathematica to find an optimal solution. …
Community's user avatar
  • 1
22 votes

Tips for golfing in Mathematica

Accessing named arguments (new in V10) One of the major new language features in Mathematica 10 is Associations, which are basically key-value maps with arbitrary key types, written like <| x -> 1, "abc … In fact, the shortest Mathematica quine (I know of) is ToString[#0][] & [] What's slightly annoying is that it won't give you the exact characters you entered. …
Martin Ender's user avatar
15 votes
4 answers
2k views

Solve a 2x2 Eigensystem

For those with a little linear algebra background, the challenge is as simple as this: determine the eigenvalues and eigenvectors of a given complex 2x2 matrix. You may skip ahead to The Challenge for …
49 votes
14 answers
4k views

Fissile Numbers

After writing a reference implementation in Mathematica, I thought this is a fun exercise to do as a separate challenge though, so here we go. Let's build a numeric fission reactor! …
25 votes

Tips for golfing in Mathematica

The reason this works is that , introduces two arguments to the list, but omitted arguments (anywhere in Mathematica) are implicit Nulls. …
Martin Ender's user avatar
23 votes

I'm a palindrome. Are you?

Mathematica, 23 bytes QemordnilaP;PalindromeQ Not very interesting, but for the sake of completeness... …
user202729's user avatar
  • 17.4k
34 votes

"Hello, World!"

So instead I wrote a solver in Mathematica which actually knows about the Pada data structures and operators to find an optimal solution. … Here is the full Mathematica if anyone ever wants to metagolf a different string in Pada: string = "Hello, World!" …
Martin Ender's user avatar
77 votes
5 answers
8k views

Recognise Stack Exchange Sites by Their Icon

Homebrewing History of Science and Math Islam Italian Language Stack Overflow in Japanese Japanese Language Joomla Mi Yodeya Linguistics Magento Martial Arts Mathematics Mathematics Educators Mathematica
7 votes

Insist on a new filename

Mathematica, 33 28 bytes f:=Input[]/._?FileExistsQ:>f This assumes Mathematica's notebook environment where we can query input from the user with Input[]. … The upside is that the input can be an arbitrary Mathematica expression that computes the input string. …
Martin Ender's user avatar
3 votes

Find relevant digit groupings

Wolfram Language (Mathematica), 30 bytes And@@#/@#2~IntegerDigits~1000& Try it online! …
Martin Ender's user avatar
2 votes

Maximum run between identical elements

Wolfram Language (Mathematica), 54 bytes Max@SequenceCases[#,{a_,b___,a_}:>2a+b,Overlaps->All]& Try it online! …
Martin Ender's user avatar
10 votes

Is it a Pascal Prime?

Wolfram Language (Mathematica), 45 bytes CompositeQ@#&&Binomial~Array~{#-1,#}~FreeQ~#& Try it online! Every composite number n appears exactly twice on row n and cannot appear afterwards. …
Martin Ender's user avatar
3 votes

Is this a three-digit number ending in one?

Wolfram Language (Mathematica), 35 bytes Or@@Array[x~Mod~#==1<x/#^2<#&,x=#]& Try it online! Explicitly checks whether n % i = 1 and i2 < n < i3 for any possible base i. …
Martin Ender's user avatar
10 votes
Accepted

Decode Factor Trees

Wolfram Language (Mathematica), 52 45 bytes ToExpression@*StringReplace[{"["->"Prime[1"}] Try it online! Input uses brackets. … Transforms the input into a Mathematica expression that computes the result. We do this simply by replacing [ with Prime[1. This works because concatenation is multiplication in Mathematica. …
Martin Ender's user avatar
1 vote

Case Permutation

Wolfram Language (Mathematica), 55 bytes ""<>#&/@Union@Tuples[{#,ToUpperCase@#}]&@*Characters Try it online!  is the transpose operator (and displays as a superscript T in Mathematica). …
Martin Ender's user avatar

1
2 3 4 5
29
15 30 50 per page