Activity for RubenVerg
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
A: Digit Sum Integer Sequence (working title) Dyalog APL, 23 bytes ```apl {⍵+(⌈/+⌊/)10⊥⍣¯1⊢⍵}⍣⎕⊢1... (more) |
— | 7 months ago |
Answer | — |
A: Label a hinged tetromino Dyalog APL, 89 bytes ```apl {1∊∘∊¨⍷¨∘⍵¨⍬{0∊⍴⍵:⍺⋄(⍺,⊂A)∇⍵A←(⌽¨,⊢)(⊖¨,⊢)(⍉¨,⊢)⊣/⍵}(e⍤⍉e←{⍵/⍨×+⌿⍵})¨4 4∘⍴¨,⌿2⊥⍣¯1⍳216} ``` Requires IO to be zero. Thanks Adám for -8 bytes! Ungolfed version: ```apl { removeEmptyRows←{⍵/⍨×+⌿⍵} removeEmptyCols←removeEmptyRows⍉ ⍝ Transpose, then rem... (more) |
— | 10 months ago |
Answer | — |
A: Probability of rolling all 6 dice faces cQuents, 10 bytes ```text O920A$/6^$ ``` That there is because, while this should be a specification-correct program that does the correct computation, the only interpreter available does not implement importing any OEIS sequence, but just a few. I suppose this might suggest this is not a va... (more) |
— | 11 months ago |
Answer | — |
A: Probability of rolling all 6 dice faces Dyalog APL, 19 bytes (with index origin zero) ```apl {-/(!∘6×⍵⍨6÷⍨⊢)⍳7} ``` This isn't bruteforce! The number of cases where all six faces appear are the OEIS sequence A000920. \[ Pn = \frac{\mathsf{OEIS}{\text{A000920}}(n)}{6^n} \] which is \[ \frac {6!} {6^n} \left\lbrace {n ... (more) |
— | 11 months ago |
Answer | — |
A: Probability of rolling all 6 dice faces Dyalog APL, 21 bytes ```apl {≢⍸6=(≢∪)¨⍳⍵/6}÷(6∘) ``` Bruteforce solution :) `⍳⍵/6` n-dimensional array of all possibilities of rolling $n$ dice, each element is a vector of the dice values `≢` count the elements `⍸` where it is true that `(≢∪)¨` the length of the unique elements `... (more) |
— | 11 months ago |
Answer | — |
A: Expected value of highest dice rolled Dyalog APL, 14 bytes ```apl {6-+/⍵⍨6÷⍨⍳5} ``` Not bruteforce! An exact implementation of the formula \[ En = 6 - \sum{i=1}^5 \left(\frac i 6\right)^n \] `6-` 6 minus `+/` the sum of `6÷⍨⍳5` the list 1/6, 2/6, 3/6, 4/6, 5/6 `⍵⍨` to the power of the argument of the function Fo... (more) |
— | 11 months ago |
Answer | — |
A: Make $2 + 2 = 5$ Dyalog APL, 9 bytes ```apl +/⊢,2 2≡⊢ ``` Takes the input as a pair `+/` sum reduce `⊢` the input `,` concatenated with `2 2≡⊢` whether the input is equal to the list `2 2` (`1` if true, `0` if false) (more) |
— | 11 months ago |
Answer | — |
A: Roll n fair dice Dyalog APL, 2 bytes ```apl ?⍴ ``` Dyadic 2-train, takes $n$ as its left argument and $m$ as its right argument The Roll function `?` expects an array of maximum bounds and replaces each item with a random number between 1 and that bound (ie `?2 6 5` returns `(random between 1 and 2) (rando... (more) |
— | 11 months ago |
Answer | — |
A: Can you give me half? [Extended] Dyalog APL, 4 bytes 10 bytes, 4 unique ```apl '÷'÷⍥≢'÷÷' ``` This computes the length of the string `'÷'` divided by the length of the string `'÷÷'` Alternate solution (extended only) (6 unique, 6 bytes) ```apl ⊢÷+⍨×∞ ``` This computes \[ \left(\lambda x.\frac{x}{... (more) |
— | 11 months ago |
Answer | — |
A: Expected value of highest dice rolled Dyalog APL, 16 bytes ```apl {(+/÷≢)⌈/¨,⍳⍵/6} ``` Explanation: `,⍳⍵/6` generate a list of all the possible sets of rolls `⌈/¨` find the maximum of each `+/÷≢` find the average (sum up all values and divide by the length of the list) this is incredibly slow and expensive memory-wise ... (more) |
— | 11 months ago |