Search Results
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 |
The challenge involves mathematics in some central way. Also consider using more specific tags, listed in the tag wiki info.
0
votes
Factorial in haiku!
Uiua
Factorial ← ⧅≠⟜∘
Read as:
Factorial ← # Factorial gets:
⧅≠ # tuples inequality
⟜∘ # on identity.
Alternatively, ⧅≠ can be read as "count permutations of l …
3
votes
Reconstruct Matrix from its diagonals
Uiua, 15 bytes
⍜⊕□◌.⊞+⟜⇌⇡⌈÷2⧻.
Try it: Uiua pad
This should be 13 bytes because ⍜⊕□◌. could hypothetically be replaced by ⌝⊕□, but it hasn't been implemented yet.
Explanation:
⌈÷2⧻ - Get the side len …
1
vote
Shift right by half a trit
Uiua, 24 bytes
⨬⍜(-1°⊂⇌base3|⊙↘⟜¯¬)0⊸<2
Try it: Uiua pad. The comment # Experimental! enables the experimental base function, which has not yet been stabilized.
Explanation: A very elegant use of the …
1
vote
Sum It Up with a Digital Triangle
Uiua, 29 bytes
∧(◿10≡/+◫2&p⊂↯:@ ⊙⊸/$"_ _")°⊏
Try it
°⊏ # range of 0 to the input's length
∧( # fold over this (N), with the input as the initial value:
⊙⊸/$"_ _" # to the value, …
2
votes
Construct the Identity Matrix
Uiua, 4 bytes
⊞=.⇡
Try it online!
Read: ⊞ table of = equality by . two copies of ⇡ the numeric range 0 to the input.
0
votes
Draw A Sierpinski Triangle
Uiua, 13 bytes
⍥⬚0(⊂≡⊂..)9¤1
Try it!
Here's the output, you can get more iterations by changing the 9 to a higher number.
Explanation:
Starting with [1], 9 times do: duplicate horizontally, and prep …
2
votes
Test a number for narcissism
Uiua, 12 bytes
=/+ⁿ⧻.-@0°⋕.
Try it
Explanation:
-@0°⋕.
Convert the number to a list of digits.
ⁿ⧻.
Raise each to the power of the list's length.
=/+
Is this list's sum equal to the original?
5
votes
Is it a tetrate of two?
Python, 32 bytes
f=lambda n,i=1:n==i or f(n,2**i)
Attempt This Online!
My idea was invalid in JS, because the recursion limit isn't guaranteed, but it's OK in Python because of that difference. Outpu …
5
votes
Modular Equivalence
Thunno 2, 7 bytes
×__Fæ2>
Attempt This Online!
Based on Command Master’s idea, implemented a bit differently
× # Multiply. X * Y
_ # Swapped subtract. X * Y - X
_ # Swa …
0
votes
The TAK function (easy mode)
JavaScript (Node.js), 28 bytes
(x,y,z)=>x<=y?y:x>y&y<=z?z:x
Attempt This Online!
Literal translation of the simple version.
1
vote
Divmod continuously until the remainder is 1 or 0, then get the remainder
TypeScript's type system, 97 bytes
//@ts-ignore
type M<A,B,T=[]>=A extends[...B,...infer I]?M<I,B,[...T,1]>:A extends[1]|[]?A:M<T,A>
Try it at the TypeScript playground!
I/O is unary numbers / tuples …
4
votes
Calculate 500 digits of e
Check that answer for a better understanding of the math.
Code explanation:
2 4000:a?:b)
2 4000 # Push 2, 4000 to the stack.
:a # Store 4000 in variable a.
? …
5
votes
Calculate 500 digits of e
Python, 100 bytes
from decimal import*
getcontext().prec=500
e=d=Decimal(1)
for x in range(2,254):e+=1/d;d*=x
print(e)
Attempt This Online!
-2 bytes thanks to RubenVerg
254 is the lowest number which …
1
vote
Print 100 digits of Champernowne's Constant
GolfScript, 6 bytes
55,(;5
Try it online!
Prints the first 100 digits.
55, # the list 0..55
(; # drop the 0
5 # push 5 to the stack
# the stack is implicitly printed without separator
Al …
2
votes
The vanilla factorial challenge
Vyxal 3L, 2 bytes
/*
Try it Online!
Fold / the input by multiplication *. Fold treats whole numbers as the range from 1 to n.
The factorial built-in is 4 bytes: fact