Activity for trichoplax
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #289226 |
There are a few things to note:
1. This is codegolf.codidact.com for recreational coding. For help with coding errors you can ask at software.codidact.com
1. Python's `#` for comments is interpreted as a heading in a question post. This is why all the comments show as huge text. You can make a co... (more) |
— | over 1 year ago |
Comment | Post #289167 |
I can't see any problem that could be caused by having a random button on a Meta category (Codidact Meta has had one all this time with no complaints...) so personally I'm in favour of just removing the restriction and having a random sort button for every category. (more) |
— | over 1 year ago |
Edit | Post #289164 | Initial revision | — | over 1 year ago |
Question | — |
A random button for ordering Code Golf post lists On most Codidact communities the posts list has a "Random" button among the sorting buttons: The sorting buttons on Codidact Meta - "Activity", "Age", "Score", and "Random" The only exceptions are the Codidact Proposals community, and Code Golf: The sorting buttons on Code Golf - "Activity",... (more) |
— | over 1 year ago |
Comment | Post #289011 |
Still the same length:
```ruby
->i{i.chars.sort_by{"jbdfghklpqyit".index(_1)||13}}
```
Giving up now... (more) |
— | over 1 year ago |
Comment | Post #289011 |
I couldn't find a way to shorten this, just ended up with the same length. You can use `0` instead of `-1` but only if you add an extra character to the string to prevent the index ever being zero, so it costs a byte to save a byte...
```ruby
->i{i.chars.sort_by{"_tibdfghklpqyj".index(_1)||0}}
`... (more) |
— | over 1 year ago |
Edit | Post #287329 |
Post edited: Reword awkward sentence |
— | over 1 year ago |
Edit | Post #288943 |
Post edited: Typo |
— | over 1 year ago |
Comment | Post #288943 |
Ah. I see what I missed now. Thank you.
Would the first sentence be clearer with the "of" replaced by something like "such that"?
Something like this:
> Given a number $n$ as input output the smallest number $k$ such that the modular residues of $k$ by the first $n$ primes is exactly $\\{-1,... (more) |
— | over 1 year ago |
Suggested Edit | Post #288943 |
Suggested edit: Typo (more) |
helpful | over 1 year ago |
Comment | Post #288943 |
To check if I've understood the requirement, does the following match the intent of the challenge?
> Given $n\ge 3$ find the smallest $k$ such that the first $n$ primes all have a multiple in $\\{k-1,k,k+1\\}$. (more) |
— | over 1 year ago |
Comment | Post #288939 |
I try to post a variety of challenges so there are some that take a minute and some that require more thought. As a result I have some with no answers yet... (more) |
— | over 1 year ago |
Comment | Post #288939 |
It was already clear, just didn't want you getting a downvote from someone who stopped reading before the end of the sentence. I'm probably being overcautious (more) |
— | over 1 year ago |
Comment | Post #288939 |
Great to see a formula for this (even if it's not yet shorter than brute force). I tried but gave up and went with brute force to generate the test cases (which took a while to run...). (more) |
— | over 1 year ago |
Comment | Post #288939 |
For anyone skim reading this answer, the phrase
> the results for $n \in \left\\{ 3, 4, 5 \right\\}$ aren't exactly zero
does not invalidate this answer. The requirement of being correct to 6 decimal places is (far more than) met. (more) |
— | over 1 year ago |
Comment | Post #288914 |
That's a really intuitive explanation. I don't know APL and I still found the visualisation easy to follow with the sequence of tables. (more) |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Mark as finalized |
— | over 1 year ago |
Edit | Post #288917 | Initial revision | — | over 1 year ago |
Question | — |
Probability of rolling all 6 dice faces The probability of rolling every number from 1 to 6 with $N$ six-sided dice. Input - A positive integer $N$. - Your code must work for inputs up to and including 10, but may crash, error, or give incorrect output for larger inputs. Output - A probability, $0 \le p \le 1$ - This is the proba... (more) |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Remove ambiguity from output section |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Add 10th test case |
— | over 1 year ago |
Comment | Post #288914 |
Even though I've convinced myself they are equivalent, I can't visualise yours, whereas I can understand mine geometrically so it makes sense to me intuitively.
If you want the geometric interpretation of mine, $i^N-(i-1)^N$ is the number of ways of rolling $N$ dice that lead to $i$ being the high... (more) |
— | over 1 year ago |
Comment | Post #288885 |
I generally default to using a numeral but it looked strange immediately after the $N$ so I went with "$N$ six-sided" rather than "$N$ 6-sided". (more) |
— | over 1 year ago |
Comment | Post #288914 |
I was curious so I tried to derive your formula from mine. Managed it by unrolling the sum and then rolling it back up at the end. No idea if this is similar to how you found it.
$$\frac{1}{6^N}\sum_{i=1}^6 i(i^N-(i-1)^N)$$
$$\frac{1}{6^N}\sum_{i=1}^6 i(i)^N-i(i-1)^N$$
$$\frac{1}{6^N}\left(\... (more) |
— | over 1 year ago |
Comment | Post #288914 |
I had to implement this formula and test it for myself because it looks so different from the formula I used to generate the test cases that I couldn't imagine it giving the same result - but it does!
For comparison, here's the formula I used:
$$\frac{1}{6^N}\sum_{i=1}^6 i(i^N-(i-1)^N)$$
Muc... (more) |
— | over 1 year ago |
Comment | Post #288903 |
I usually try to make a reference implementation before posting a challenge, but in this case it only exists in my head (which means it's untested). At some point I'll implement it in real code and post it as an answer. It uses a more generic approach which I'm not sure will be golfy (I just needed t... (more) |
— | over 1 year ago |
Comment | Post #288903 |
Glad your testing was more thorough than mine... I should probably generate the exhaustive list of test cases for testing future entries. (more) |
— | over 1 year ago |
Edit | Post #288502 |
Post edited: Emphasise that label must stay the same when moved |
— | over 1 year ago |
Comment | Post #288903 |
I love the detailed explanation!
I couldn't tell from the explanation whether this would still work with the shapes at different positions in the 4 by 4 input area. I adjusted some of the test cases by translating them down or to the right by adding newlines or spaces and they still work.
I als... (more) |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Change test cases from 6 significant figures to 6 decimal places |
— | over 1 year ago |
Comment | Post #285880 |
I notice that several of the answers show on the leaderboard with their byte count instead of the number of unique characters, which often gives them a significantly higher (worse) score. In many cases this is because the answer heading shows the unique characters and the byte count, and the leaderbo... (more) |
— | over 1 year ago |
Comment | Post #288897 |
I was wondering if someone would take the brute force approach. I didn't want to rule it out so I set the maximum required input low. Even with the closed form solution that I used to generate the test cases, I couldn't go much higher without switching to arbitrary precision numbers. (more) |
— | over 1 year ago |
Edit | Post #288885 |
Post edited: Remove redundant test case bullet point |
— | over 1 year ago |
Edit | Post #288885 |
Post edited: Specify face values of the 6 faces of the dice |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Extra mention that the dice are six-sided |
— | over 1 year ago |
Edit | Post #288885 |
Post edited: Specify six-sided dice in intro following feedback |
— | over 1 year ago |
Comment | Post #288885 |
Thanks for the feedback. The first point of the output section mentions "six-sided dice". I left this out of the introductory paragraph for brevity, but I'll add it in now so it's clear from the start of reading. (more) |
— | over 1 year ago |
Edit | Post #288848 |
Post edited: Streamline |
— | over 1 year ago |
Edit | Post #288885 |
Post edited: Specify six-sided dice |
— | over 1 year ago |
Edit | Post #288805 |
Post edited: Mark as finalized |
— | over 1 year ago |
Edit | Post #288885 | Initial revision | — | over 1 year ago |
Question | — |
Expected value of highest dice rolled You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score? Input - A positive integer $N$. - Your code must work for inputs up to and including 10, but may crash, error, or give incorrect... (more) |
— | over 1 year ago |
Edit | Post #288805 |
Post edited: Streamline |
— | over 1 year ago |
Edit | Post #282804 |
Post edited: Add finalized tag now that the sandbox can be filtered to exclude tags (this isn't really a sequence question) |
— | over 1 year ago |
Edit | Post #282881 |
Post edited: Add finalized tag now that the sandbox can be filtered to exclude tags |
— | over 1 year ago |
Edit | Post #283231 |
Post edited: Add finalized tag now that the sandbox can be filtered to exclude tags (this isn't really array manipulation) |
— | over 1 year ago |
Edit | Post #283620 |
Post edited: Add finalized tag now that the sandbox can be filtered to exclude tags |
— | over 1 year ago |
Edit | Post #283649 |
Post edited: Add finalized tag now that the sandbox can be filtered to exclude tags |
— | over 1 year ago |
Edit | Post #283858 |
Post edited: Add finalized tag now that the sandbox can be filtered to exclude tags |
— | over 1 year ago |
Edit | Post #283799 |
Post edited: Add finalized tag now that the sandbox can be filtered to exclude tags |
— | over 1 year ago |