56 votes

(-a) × (-a) = a × a

18 Steps ...
  • 3,351
36 votes

(-a) × (-a) = a × a

18 steps Different from the already posted 18-step solution. ...
29 votes

(-a) × (-a) = a × a

29 26 Steps No lemmas! Comment if you see anything wrong. (It's very easy to make a mistake) ...
  • 11.4k
21 votes

How does the square end?

Google Sheets, 52 51 47 bytes =ArrayFormula(Join(",",Unique(Mod(Row(A:A)^2,A1 Saved 4 bytes thanks to Taylor Scott Sheets will automatically add 4 ...
21 votes
Accepted

Demonstrate some advanced abstract algebra

Proof of impossibility The only anti-distributive operator when \$S=\mathbb Z\$ is such that \$\forall a, \forall b, a*b=0\$. Indeed, suppose that \$*\$ is anti-distributive. Then \$*\$ has the ...
  • 15.2k
20 votes

(-a) × (-a) = a × a

18 steps Not the first 18-step proof, but it’s simpler than the others. ...
18 votes
Accepted

Factor a polynomial over a finite field or the integers

GolfScript (222 bytes) ...
  • 42.8k
17 votes
Accepted

Counting groups of a given size

CJam, 189 187 bytes This one's gonna be tough to explain... Time complexity is guaranteed to be O(scary). ...
16 votes
Accepted

Cycling with Rubik's

Pyth, 66 63 bytes l.uum.rW}Hdd@_sm_B.iFP.>c3Zk3xZHG_r_Xz\'\39Nf!s}RTcZ2y=Z"UDLRFB Try it online: Demonstration or Test Suite. Notice that the program is kinda ...
  • 21.8k
16 votes
Accepted

Compute the inverse of an integer modulo 100000000003

Pyth, 24 bytes L-b*/bJ+3^T11Jy*uy^GT11Q Test suite This uses the fact that a^(p-2) mod p = a^-1 mod p. First, I manually reimplement modulus, for the specific ...
  • 41.4k
16 votes

Fundamental Solution of the Pell Equation

Piet, 612 codels Takes n from standard input. Outputs y then x, space-separated. Codel size 1: Codel size 4, for easier viewing: Explanation Check out this NPiet trace, which shows the program ...
  • 1,651
14 votes

Multiply elements of the dihedral group

J, 23 bytes ~:/I.@,~4|[:-/1#;._1@,] Try it online! Takes a boolean vector where 0 represents ...
  • 66.1k
13 votes

Cycling with Rubik's

GAP, 792 783 782 749 650 Bytes This seems to be working. If it messes up with something let me know. Thanks to @Lynn for suggesting that I decompose some of the primitive moves. Thanks to @Neil for ...
  • 3,175
13 votes

∀ a b. a + b = b + a

Lean, 451 449 445 439 414 407 bytes ...
12 votes

Define a field with 256 elements

Python 2, 11 + 45 = 56 bytes Addition (11 bytes): int.__xor__ Multiplication (45 bytes): ...
  • 61.1k
12 votes

(-a) × (-a) = a × a

23 steps ...
  • 363
12 votes

∀ a b. a + b = b + a

Lean, 268 bytes ...
11 votes

No strings attached!

Retina, 21 bytes +`(.)(?!\1)(?i)\1 ^$ Try it online! Like flawr's solution, this just repeatedly deletes adjacent uppercase/lowercase pairs and then checks ...
11 votes

Square root a number

Python 2, 166 bytes ...
  • 38.8k
11 votes

Are these braids equal?

Haskell, 190 bytes ...
11 votes

Modular multiplicative inverse

Mathematica, 14 bytes Obligatory Mathematica builtin: ModularInverse It's a function that takes two arguments (a and ...
  • 571
10 votes
Accepted

Generate the group table for Z_n

APL (10) (Assuming ⎕IO=0. It works on ngn/apl by default, other APLs tend to need an ⎕IO←0 first.) ...
  • 31.1k
10 votes

Cycling with Rubik's

Mathematica, 413 401 bytes ...
  • 3,082
10 votes

Algebraic curve plotter

Haskell, 283 275 bytes The function g should be called with the matrix and the two ranges as arguments. The matrix is just a list of lists, the ranges each a two ...
  • 43.2k
10 votes

Fundamental Solution of the Pell Equation

Piet, 184 codels This is the brute-force alternative I said (in my other answer) that I didn't want to write. It takes over 2 minutes to compute the solution for n = 13. I really don't want to try it ...
  • 1,651
10 votes

Dihedral group D4 composition with custom labels

Ruby, 18 bytes ->a,b{a+b*~0**a&7} Ungolfed ...
10 votes

AoCG2021 Day 22: Hyperbolic rescue

Perl 5 -p, 83 bytes s/./"bc"x($&+3)."ab"/ge;1while s/(.)\1//+s/(b|cac)a/a$1/+s/(cbcbca?)b/b$1/;$_=y/a// ...
9 votes

Multiply Pauli Matrices

Python 2, 108 89 87 86 bytes x=y=0 for m in map(int,raw_input()):x+=m*y and(m-y)%3*3/2;y^=m print"--i"[~x%4::2]+`y` (Thanks to @grc and @xnor for the help) ...
  • 61.1k
9 votes
Accepted

Irreducible polynomials over GF(5)

Jelly, 30 23 22 20 bytes ÆF>1’PḄ ÆDµU5*×Ç€S:Ṫ Try it online! or verify all test cases at once. Algorithm This uses the formula $$\text{A001692}(n) = \frac 1 n \...
  • 207k
9 votes

Compute the inverse of an integer modulo 100000000003

Haskell, 118 113 105 101 bytes Inspired from this solution. -12 from Ørjan Johansen ...
  • 1,301

Only top scored, non community-wiki answers of a minimum length are eligible