Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for RubenVerg‭

Type On... Excerpt Status Date
Edit Post #289925 Post edited:
wrong description
7 months ago
Edit Post #289925 Post edited:
misread challenge
7 months ago
Edit Post #289925 Initial revision 7 months ago
Answer A: Digit Sum Integer Sequence (working title)
Dyalog APL, 23 bytes ```apl {⍵+(⌈/+⌊/)10⊥⍣¯1⊢⍵}⍣⎕⊢1­⁡​‎‎⁡⁠⁢⁢⁢‏⁠‎⁡⁠⁢⁢⁣‏‏​⁡⁠⁡‌⁢​‎⁠⁠‎⁡⁠⁢⁡⁤‏⁠‎⁡⁠⁢⁢⁡‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌⁤​‎⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏⁠‎⁡⁠⁤⁢‏⁠‎⁡⁠⁤⁣‏⁠‎...
(more)
7 months ago
Edit Post #288899 Post edited:
-1 unique
9 months ago
Edit Post #289001 Post edited:
fix ungolfed
10 months ago
Edit Post #289001 Post edited:
-8 bytes (thanks Adám)
10 months ago
Edit Post #289001 Post edited:
10 months ago
Edit Post #289001 Initial revision 10 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
Comment Post #288939 I just realized this place is two years old and not, like, a few months, but my point still stands
(more)
10 months ago
Edit Post #288944 Initial revision 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)
10 months ago
Comment Post #288939 from a somewhat shallow look, it seems as though this site still has a quite small userbase, I'm sure the answers will come trickling in sooner or later :)
(more)
10 months ago
Comment Post #288939 Also, I wonder if there is another nice visualization of the answer like the one I eventually found for the one about the max roll. Might think about that for a bit.
(more)
10 months ago
Comment Post #288939 I feel like someone who doesn't read the whole post before voting also won't read comments :) thanks for caring @#53890 tho! gotta say these nice entry-level challenges are refreshing, on cgse there's this "you're answering a 9 years old question" every time I want to do some basic q's. i'm a sucker ...
(more)
10 months ago
Edit Post #288939 Post edited:
clarify validity of solution
10 months ago
Comment Post #288939 right, might clarify this in my answer
(more)
10 months ago
Comment Post #288939 I'd hoped you also had a much more intuitive closed form than mine for this problem :) I guess I kinda cheated by looking it up on the OEIS, though I suppose I could've come up with it with some more days of thought
(more)
10 months ago
Edit Post #288914 Post edited:
10 months ago
Edit Post #288939 Post edited:
FPE for some inputs
10 months ago
Edit Post #288939 Initial revision 10 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)
10 months ago
Edit Post #288919 Post edited:
-1 byte
10 months ago
Comment Post #288914 thanks for the feedback, was experimenting with this new style for long visual explanations - I would've generated the tables with APL anyways, might as well put the code in as well :)
(more)
10 months ago
Comment Post #288914 @#53890 I've added an explanation for what I visualize my function to be doing (and also realized that, of course, $7 - \left(\frac 6 6\right)^n$ is just $6$ :) )
(more)
10 months ago
Edit Post #288914 Post edited:
add explanation, change code slightly
10 months ago
Comment Post #288914 Yep, I read your sol and instantly went "oh this is a generalization of the 2n-1 "shells" for the 6x6 table. Still trying to figure out mine :) and also why the one I had without 7- doesn't give the correct answer (like, I get why it can't work - it's decreasing instead of approaching 6 in the limit,...
(more)
10 months ago
Edit Post #288919 Initial revision 10 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)
10 months ago
Comment Post #288914 I found it by first writing just the sum, without the 7 - part, realized it was accidentally decreasing in the limit but that the n=1 case was correct, so I just tried to flip it and shift it up and it worked. I'm not really sure how it works - still trying to figure that out :) thanks for working ou...
(more)
10 months ago
Edit Post #288914 Initial revision 10 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)
10 months ago
Edit Post #288848 Post edited:
Add test cases for 7, 8 and 9
10 months ago
Suggested Edit Post #288848 Suggested edit:
Add test cases for 7, 8 and 9
(more)
helpful 10 months ago
Edit Post #288901 Initial revision 10 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)
10 months ago
Edit Post #288900 Initial revision 10 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)
10 months ago
Edit Post #288899 Post edited:
does the leaderboard like this more?
10 months ago
Edit Post #288899 Initial revision 10 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)
10 months ago
Comment Post #288897 I think this has also a hard limit after n = 17 (if I remember correctly), because an intermediate step is generating a n-dimensional array and 17 is the maximum rank allowed in dyalog
(more)
10 months ago
Comment Post #288897 I was trying to come up with a closed form solution, but realized it would almost definitely be longer than just generating all the cases, which is quite short in APL. I suppose I'll try to get a closed form anyways and see if I was right
(more)
10 months ago
Edit Post #288897 Post edited:
10 months ago
Edit Post #288897 Initial revision 10 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)
10 months ago