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 tagged with
Search options not deleted user 31849

The challenge involves mathematics in some central way. Also consider using more specific tags, listed in the tag wiki info.

12 votes

Smallest integers after N divisible by 2, 3, and 4

MATL, 8 bytes Qt_2:4\+ Uses Denis' Jelly algorithm, I'm surprised it's the same length! Try it online, or, verify all test cases. Q % takes implicit input and increments by one t_ % duplicat …
David's user avatar
  • 1,316
6 votes

Output the Juggler sequence

MATL, 13 12 bytes `tt2\.5+^ktq Try it online! Explanation ` % do...while loop tt % duplicate top of stack twice, takes implicit input on first iteration 2\ % take a_k mod 2 .5+^ % adds …
David's user avatar
  • 1,316
4 votes

Two steps forward and one step back

MATL, 7 bytes Uses the 3*n-4*(n>1) formula. Multiply input by 3 (3*), push input again (G) and decrement it (q). If the result is not zero (?) then subtract 4 from the result (4-). 3*Gq?4- Try it …
David's user avatar
  • 1,316
3 votes

Find the number in the Champernowne constant

MATL, 22 bytes it10+:Yst' '=~)wYsXf1) Take the input (i), make the vector 1 to input+10 (10+:), converts the vector to a string (Ys), and remove the spaces, which is painful, (t' '=~)). Then, conve …
David's user avatar
  • 1,316
3 votes

Derivative at the Edge

MATL, 21 15 bytes 2/d1)6Mh8Mt0)h+ TryItOnline Halves the input vector, and takes successive differences, to give d=[i(2)-i(1) i(3)-i(2) ... i(end)-i(end-1)]/2 and then makes two modified vectors, …
David's user avatar
  • 1,316
2 votes

Where should I put my restaurant?

MATLAB, 42 If it is OK to take input as I=[5.7 3.2 8.9 8.1] then this statement fminunc(@(y)sum(hypot(I(:,1),I(:,2)-y)),0) returns 5.113014445748538. Shamelessly stealing Thomas Kwa's meth …
David's user avatar
  • 1,316
1 vote

Solve an algebraic expression

Matlab, 61 bytes x=[1 0];a=eval([strrep(input(''),'=','-(') ')']);a(2)/diff(a) Uses the same algorithm as Ton Haspel to solve the equation. Replaces the = by -( and adds a ) at the end to make the …
David's user avatar
  • 1,316
1 vote
Accepted

Identify the Conic Section

Matlab, 154 bytes p=input();c=null([p.^2 prod(p,2) p 1+p(:,1)*0]),s={'circle' 'ellipse' 'parabola' 'hyperbola'};s{3+sign(c(3)^2-4*c(1)*c(2))-~max(abs(c(3)),abs(c(1)-c(2)))} Saved some bytes thanks …
David's user avatar
  • 1,316
1 vote

Divisor reduction

MATL, 13 bytes tX`t:\ztt]Nq& Try it online Explanation: t % Duplicate input X` ] % while loop, consumes 1 input t:\z % calculates n-d(n), by counting number no …
David's user avatar
  • 1,316