Skip to main content
54 votes

Absolute Sums of Sidi Polynomial Coefficients

Python 2, 43 bytes f=lambda n,k=1:k/n or n*f(n,k+1)+k*f(n-1,k) Try it online! A different approach Ever since I posted this challenge, I tried to come up with a ...
Dennis's user avatar
  • 210k
27 votes

Find the polynomial

Jelly, 3 bytes ‘b@ Try it online! Returns the polynomial as a list of coefficients. Since we know the polynomial has non-negative integer coefficients, f(b) ...
Doorknob's user avatar
  • 71.5k
17 votes

Многочлены Чебышёва (Chebyshev Polynomials)

Mathematica, 15 bytes #~ChebyshevT~x& Of course, Mathematica has a builtin. If an alternative input form is allowed (10 bytes): ...
JungHwan Min's user avatar
  • 13.8k
17 votes

Recover polynomial \$f(x)\$ from \$f^2(x)\$

Python 2, 638 634 608 603 572 560 508 470 bytes (without brute force as well) Tthanks to @randomdude999 for the golfing down the code by like 100 bytes as well as everyone who has helped point out ...
Ariana's user avatar
  • 271
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 ...
Tim Pederick's user avatar
  • 1,721
14 votes

Discrete Convolution or Polynomial Multiplication

J, 10 8 bytes [:+//.*/ Usage: ...
ljeabmreosn's user avatar
14 votes

Многочлены Чебышёва (Chebyshev Polynomials)

Octave, 39 bytes @(n)round(2^n/2*poly(cos((.5:n)/n*pi))) Try it online! Explanation cos((.5:n)/n*pi) builds a vector with the ...
Luis Mendo's user avatar
  • 105k
13 votes
Accepted

Shamir's Secret Sharing

Jelly, 15 bytes 251©xX€⁵0¦ḅЀ%® Expects t, n, and s as command-line arguments. Try it online! How it works ...
Dennis's user avatar
  • 210k
13 votes

Ryley's Theorem

PARI/GP, 35 bytes r->[x=r+1/3,-x+r/3/d=x^2-r,1/9/d-1] Attempt This Online! PARI/GP, 40 bytes ...
alephalpha's user avatar
  • 48.7k
12 votes

Rotate the Roots

Mathematica, 10 Bytes Pure function which takes a function of x and substitutes in ix. #/.x->I*x& Alternative with only 7 bytes but not quite sure if it ...
Ian Miller's user avatar
12 votes

Cyclotomic polynomial

Haskell, 120 bytes import Data.Complex p%a=zipWith(\x y->x-a*y)(p++[0])$0:p f n=foldl(%)[1][cis(2*pi/fromInteger n)^^k|k<-[1..n],gcd n k<2] Try it ...
xnor's user avatar
  • 145k
12 votes

Evaluate polynomial expression string

JavaScript (ES7), 48 bytes Based upon a suggestion from @RickHitchcock Expects X in uppercase. Takes input in currying syntax ...
Arnauld's user avatar
  • 194k
12 votes

Calculate the Ultraradical

Wolfram Language (Mathematica), 20 bytes Root[xx^5+x+#,1]& Try it online! Still a built-in, but at least it isn't ...
DELETE_ME's user avatar
  • 17.3k
12 votes

Laguerre Polynomials

Python 2, 53 bytes f=lambda n,x:n<1or((2*n-1-x)*f(n-1,x)-~-n*f(n-2,x))/n Try it online!
xnor's user avatar
  • 145k
12 votes

Rook Polynomials

JavaScript (ES6), 31 bytes Expects (m)(n)(k). m=>n=>g=k=>k?m--*n--/k*g(--k):1 Try it online! How? Like other answers, ...
Arnauld's user avatar
  • 194k
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 ...
flawr's user avatar
  • 43.9k
11 votes

Многочлены Чебышёва (Chebyshev Polynomials)

Pari/GP, 12 bytes Yes, a builtin. Shorter than Mathematica. polchebyshev Try it online! Without builtin: Pari/GP, 34 bytes ...
alephalpha's user avatar
  • 48.7k
11 votes

Characteristic polynomial

SageMath, 3 bytes 5 bytes saved thanks to @Mego fcp Try it online! Takes a Matrix as input. ...
Uriel's user avatar
  • 13.2k
11 votes

Laguerre Polynomials

Wolfram Language (Mathematica), 9 bytes LaguerreL Try it online!
ZaMoC's user avatar
  • 24.9k
11 votes

Exponential transform of an integer sequence

05AB1E, 21 20 18 16 bytes L©ææʒ˜{®Q}€€gèPO Try it online! Returns the \$ i \$-th term, zero indexed. It runs in complexity \$ \Omega(2^{2^i}) \$, so it can only ...
Command Master's user avatar
11 votes

Print all Polynomials

Python, 56 bytes P=[[0]] for*t,h in P:print(P[-1]);P+=t+[h,0],t+[(h<1)-h] Try it online! Prints lists indefinitely as polynomials reversed. The idea is that ...
xnor's user avatar
  • 145k
10 votes

Многочлены Чебышёва (Chebyshev Polynomials)

Haskell, 62 bytes t n|n<2=1:[0|n>0]|x<-(*2)<$>t(n-1)++[0]=zipWith(-)x$0:0:t(n-2) Try it online! flawr saved a byte.
lynn's user avatar
  • 68.9k
10 votes

Pretty Print Polynomials

Retina 0.8.2, 56 bytes (?=( \S+)+) x^$#1 \b0x.\d+ \b1x x x.1 x 0 - - + Try it online! Link includes test cases. Explanation: ...
Neil's user avatar
  • 173k
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 ...
Tim Pederick's user avatar
  • 1,721
10 votes

Computing a specific coefficient in a product of polynomials

J, 21 19 18 bytes { ::0[:+//.@(*/)/> Try it online! -1 byte thanks to FrownyFrog J has a nice geometric idiom for multiplying polynomials, which we ...
Jonah's user avatar
  • 33.6k
10 votes

"Factorise" a quadratic

Scala 3, 49 44 bytes a=>b=>(-b*b to b*b)map(p=>a-p->p)find(_*_==b) Try it onlne! Takes (a)(b) and returns an ...
user's user avatar
  • 337
10 votes

Fibonacci polynomials

J, 13 11 bytes $1j1#]!&i.- Attempt This Online! -2 bytes thanks to @ovs Looking at the nonzero columns, some keen eyes may have noticed that the columns look ...
Bubbler's user avatar
  • 77.5k
10 votes

Rook Polynomials

Python, 63 50 bytes lambda m,n,k:comb(m,k)*perm(n,k) from math import* Attempt This Online! To place \$k\$ rooks on an \$m\times n\$ chessboard, we choose \$k\$ ...
xigoi's user avatar
  • 7,281
9 votes

Absolute Sums of Sidi Polynomial Coefficients

Mathematica, 33 32 bytes Saved one byte thanks to JungHwan Min. Binomial[#,r=0~Range~#].(r+1)^#&
alephalpha's user avatar
  • 48.7k

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