58
votes
37
votes
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)
...
22
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
(-a) × (-a) = a × a
18 steps
Not the first 18-step proof, but it’s simpler than the others.
...
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 ...
18
votes
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 ...
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 ...
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 ...
14
votes
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 ...
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 ...
13
votes
12
votes
Define a field with 256 elements
Python 2, 11 + 45 = 56 bytes
Addition (11 bytes):
int.__xor__
Multiplication (45 bytes):
...
12
votes
11
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 ...
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
11
votes
11
votes
Modular multiplicative inverse
Mathematica, 14 bytes
Obligatory Mathematica builtin:
ModularInverse
It's a function that takes two arguments (a and ...
10
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 \...
10
votes
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 ...
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, 82 bytes
s/./"bc"x($&+3)."ab"/ge;1while s/(.)\1//+s/(b|cac)a/a$1/+s/(cbcbca?)b/b$1/;$_=y;a;
...
10
votes
Normal Subgroups of \$S_4\$
JavaScript (ES6), 23 bytes
Expects a permutation of the string "4567" and returns 0 ... ...
10
votes
Detect round trips on a hyperbolic grid
Retina 0.8.2, 55 bytes
\d
$*RF
FRRRFRRRF
RFRFR
FRFRF
RRRFRRRFRRR
}`FF|RRRR
^$
Try it online! Takes input as 123 but test suite ...
9
votes
Compute the inverse of an integer modulo 100000000003
Haskell, 118 113 105 101 bytes
Inspired from this solution.
-12 from Ørjan Johansen
...
9
votes
Accepted
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
abstract-algebra × 66code-golf × 65
math × 40
polynomials × 10
geometry × 9
decision-problem × 6
number-theory × 6
permutations × 6
string × 5
number × 5
sequence × 4
matrix × 4
combinatorics × 3
restricted-time × 3
linear-algebra × 3
open-ended-function × 3
rubiks-cube × 3
ascii-art × 2
primes × 2
array × 2
lean × 2
graphical-output × 1
random × 1
graph-theory × 1
base-conversion × 1