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 65532

A competition to solve a particular problem through the usage and manipulation of numbers.

2 votes

Swap the parity

Python, 20 bytes lambda n:n+(n%2or-1) n%2or-1 will return 1 if it's odd, but if it's even, n%2 is "false" (0), so it instead returns -1. Then we simply add that to n. Previous solution, 23 bytes …
numbermaniac's user avatar
2 votes

Swap the parity

Mathematica, 22 19 bytes Saved 3 bytes thanks to Greg Martin! #-1[-1][[#~Mod~2]]& Previous answer, 22 bytes #+{-1,1}[[#~Mod~2+1]]& Explanation (for previous answer) Mathematica has the nice fe …
numbermaniac's user avatar
1 vote

Swap the parity

Casio-Basic, 27 bytes piecewise(mod(n,2),1,-1)+n 26 bytes for the function, +1 to enter n in the parameters box.
numbermaniac's user avatar
1 vote

Multiply and Divide

Mathematica, 82 74 bytes x=Sort@*IntegerDigits;Do[If[x[i#]==x@Floor[i/#]==x@i,Break@i],{i,#2,∞}]& -8 bytes thanks to tsh Function that takes arguments as [x,y]. Effectively a brute force search th …
numbermaniac's user avatar
0 votes

Operator that combines sum, product and difference between two numbers

Mathematica, 67 bytes c=Ceiling;l=Log10;#-#2+(#+#2)10^(c@l[#-#2]/. 0->1)+10^c@l[2#]10#2#& Takes x-y, then takes the log10 of x-y, rounds it up, calculates 10 to the power of that and then multiplie …
numbermaniac's user avatar
2 votes

Monday Mini-Golf #7: Simplify ingredient measurements

a,r@z}]~Do~3;Print@Row[{x,y,z}/. 0->""] Explanation First get the user input, split that input on whitespace, and assign that to n. i=#~Mod~1& creates a function that gets the fractional part of a number … If[v~MemberQ~i[a = (x + y)/s@z], {x, y, z} = {Floor@a, i@a, r@z}]~Do~3 Now, the maximum number of times we need to go up a unit is 3; that would be fluid ounces (f) -> pints (p) -> quarts (q) -> gallon …
numbermaniac's user avatar
0 votes

Multiply two numbers

Casio Basic, 6 bytes a*b No surprises there. 3 bytes for the program, and 3 bytes to add a,b as parameters.
numbermaniac's user avatar
1 vote

Sum of all integers from 1 to n

Mathematica, 9 bytes #(#+1)/2& or, at 11 bytes, Tr@Range@#&
numbermaniac's user avatar
1 vote

Sum of all integers from 1 to n

Casio Basic, 9 bytes (n+1)n/2 8 bytes for the code, +1 to add n as parameter.
numbermaniac's user avatar
0 votes

Fibonacci function or sequence

Mathematica, 32 26 bytes -6 bytes thanks to @MartinEnder! ±1=±2=1;±n_:=±(n-1)+±(n-2) Recursive function, returns nth value in sequence.
numbermaniac's user avatar
0 votes

Count up forever

Casio Basic, 27 bytes For 1⇒z To ∞ Print z Next The largest integer the fx-CP400 can store precisely is a bit over 22032, or 611 digits. Chances are it'll keep counting up to 101000 before overflow …
numbermaniac's user avatar
0 votes

Reverse Maths Cycles

Casio-Basic, 108 bytes {x+y,x*y,x-y,int(x/y),x-int(x/y)y,x^y}⇒o dim(l)⇒e Print seq(o[i-int(i/6)6+1]|{x=l[i+1],y=l[e-i]},i,0,e-1) That was painful. Especially because mod(x,y) returns x when it real …
numbermaniac's user avatar
1 vote

Exponent of complex numbers

Casio-Basic, 6 bytes a^b Change to the rules to allow input and output as complex numbers made this significantly shorter. 3 bytes for the function, +3 to enter a,b in the parameters box.
numbermaniac's user avatar
0 votes

Am I an insignificant array?

Casio-Basic, 28 bytes judge(max(abs(⊿list(n)))<2 It's nice that the fx-CP400 has a built-in for cumulative differences. Not so nice that you need to use judge to force it to check whether the resul …
numbermaniac's user avatar
1 vote

Evaluate the primorial of a number

Casio-Basic, 41 bytes prod(seq(piecewise(isPrime(x),x,1),x,1,n Since the calculator doesn't have a "select" function of any kind, a piecewise/hybrid function is used to return the number if it's prime …
numbermaniac's user avatar