https://codegolf.codidact.com/categories/50/feedNew Posts - Sandbox - Code GolfCode Golf - Codidact2024-03-11T17:56:14Zhttps://codegolf.codidact.com/posts/291002The 50 substrings that validate any string of Roman numerals [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902024-03-06T00:11:16Z2024-03-11T17:56:14Z<h3>Now posted: <a href="https://codegolf.codidact.com/posts/291048">The 50 substrings that validate any string of Roman numerals</a></h3>
<hr>
<p>Given a string of Roman numerals, decide whether...https://codegolf.codidact.com/posts/29100512-hour time is weird [finalized]honnzahttps://codegolf.codidact.com/users/532222024-03-06T11:03:13Z2024-03-08T13:34:53Z<p>Posted: <a href="https://codegolf.codidact.com/posts/291018">https://codegolf.codidact.com/posts/291018</a></p>
<p>Your mission for today, should you choose to accept it, is to write a simple <...https://codegolf.codidact.com/posts/290852Fibonacci numbers with no consecutive digits [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902024-02-17T23:00:46Z2024-02-19T15:06:51Z<h1>Now posted: <a href="https://codegolf.codidact.com/posts/290870">Fibonacci without consecutive digits</a></h1>
<hr>
<p>Output the Nth number in the list of <a href="https://en.wikipedia.org/w...https://codegolf.codidact.com/posts/290612Print virtual fractions / 2-adic fractions / Modular multiplicative inverse [FINALIZED]H_Hhttps://codegolf.codidact.com/users/646282024-01-22T18:16:00Z2024-02-02T18:31:35Z<h2>Now posted: <a href="https://codegolf.codidact.com/posts/290667">Print virtual fractions / 2-adic fractions / Modular multiplicative inverse</a></h2>
<hr>
<h3>TL;DR</h3>
<p>Print this values...https://codegolf.codidact.com/posts/287238Arbitrary angle wrapping wordsearchtrichoplaxhttps://codegolf.codidact.com/users/538902022-10-12T02:56:33Z2023-10-29T11:08:16Z<h1>Sandbox</h1>
<ul>
<li>
<p>Would you change anything about the test case format?</p>
</li>
<li>
<p>Are there any more edge cases to add to the test cases?</p>
</li>
<li>
<p>Should words...https://codegolf.codidact.com/posts/287403Shortest representation in generalised Roman numerals [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902022-11-15T00:32:35Z2023-10-13T12:43:52Z<h1><a href="https://codegolf.codidact.com/posts/290000">Posted</a></h1>
<p>Given an integer, find its shortest representation in generalised Roman numerals. Since there is more than one way to ge...https://codegolf.codidact.com/posts/289956Single character Roman numeral [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902023-10-11T19:23:05Z2023-10-13T03:28:52Z<h2>Now posted: <a href="https://codegolf.codidact.com/posts/289996">Single digit Roman numeral</a></h2>
<p>Given a single character, which is a valid Roman numeral, output its value.</p>
<h2>Val...https://codegolf.codidact.com/posts/289866Borromean coprimes [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902023-10-01T23:08:21Z2023-10-07T23:08:03Z<h1>Now posted: <a href="https://codegolf.codidact.com/posts/289921">Borromean coprimes</a></h1>
<hr>
<p>Given 3 positive integers, indicate whether they are Borromean coprimes.</p>
<h2>Definiti...https://codegolf.codidact.com/posts/2870823D compass point from 3D coordinatestrichoplaxhttps://codegolf.codidact.com/users/538902022-09-26T21:42:06Z2023-09-16T08:20:02Z<p>Given 3 dimensional (3D) Cartesian coordinates (x, y, z), output the 3D compass point that comes nearest to describing the direction from the origin.</p>
<h2>Definitions</h2>
<h3>Directions</h...https://codegolf.codidact.com/posts/289678Is it part of the mandelbrot set? [FINALIZED]H_Hhttps://codegolf.codidact.com/users/646282023-09-12T12:32:47Z2023-09-13T10:20:30Z<h2>Now <a href="https://codegolf.codidact.com/posts/289681">posted</a></h2>
<hr>
<p>Input is a number, you have to decide if it is part of the mandelbrot set or not, after at least 16 iterations...https://codegolf.codidact.com/posts/288755A word suggester [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902023-06-28T11:53:03Z2023-08-28T16:11:47Z<h1>Now posted: <a href="https://codegolf.codidact.com/posts/289542">Word suggesting</a></h1>
<hr>
<p>Suggest a word from a word list, given a string.</p>
<h2>Motivation</h2>
<p>Imagine typing ...https://codegolf.codidact.com/posts/288848Probability of rolling all 6 dice faces [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902023-07-03T21:55:16Z2023-07-08T14:55:09Z<h2>Now posted: <a href="https://codegolf.codidact.com/posts/288917">Probability of rolling all 6 dice faces</a></h2>
<hr>
<p>The probability of rolling every number from 1 to 6 with $N$ six-side...https://codegolf.codidact.com/posts/288805Expected value of highest dice rolled [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902023-07-01T18:31:26Z2023-07-06T21:14:17Z<h2>Now posted: <a href="https://codegolf.codidact.com/posts/288885">Expected value of highest dice rolled</a></h2>
<hr>
<p>You roll $N$ dice simultaneously. Your score is the highest number roll...https://codegolf.codidact.com/posts/282804Caesar shift cipher [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-07-25T03:07:51Z2023-07-06T13:38:21Z<h1>Introduction</h1>
<p>What is ROT13? It's basically a cipher sequence that changes a letter's value from the number chosen. If we use ROT1 on "games", we get "hbnft". The basic interpretation o...https://codegolf.codidact.com/posts/28288199 Shortened Bottles of Beer [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-07-27T06:48:42Z2023-07-06T13:38:03Z<h1>Disclaimer</h1>
<p>This challenge also exists in <a href="https://codegolf.stackexchange.com/questions/64198/99-bottles-of-beer">CGCC</a>, but if you want to compete here (too), then hop in!</...https://codegolf.codidact.com/posts/283231A chunk of symbols is a calculation [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-08-08T21:33:40Z2023-07-06T13:36:16Z<h1>Challenge</h1>
<p>Create a program that takes input of a string and outputs an integer using the following calculation system:</p>
<ul>
<li>The string can only contain <code>+</code>, <code>...https://codegolf.codidact.com/posts/283620My house is destroyed! Can you make me one? [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-08-20T06:34:24Z2023-07-06T13:33:43Z<h1>Background</h1>
<p>I went on an adventure<br>
Grabbed resources and making deeds<br>
Like start to work on the materials<br>
To build the shelter I need</p>
<p>It was a marvelous one<br>
...https://codegolf.codidact.com/posts/283649Make my value binary [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-08-23T06:35:41Z2023-07-06T13:33:05Z<h1>Challenge</h1>
<p>What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an <code>int</code> then turn ...https://codegolf.codidact.com/posts/283858Stairs? Stairs! Stairs. [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-08-31T07:20:29Z2023-07-06T13:32:37Z<h1>Challenge</h1>
<ul>
<li>Make a program that takes input of an integer that's $n > 1$ and print out a staircase using a specific character for stair basing (hashes (<code>#</code>) for demo...https://codegolf.codidact.com/posts/283799Abbreviate everything [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-08-28T03:23:45Z2023-07-06T13:32:25Z<h1>Challenge</h1>
<p>Make a program that takes input of a string and abbreviate it.</p>
<ul>
<li>All letters of an abbreviation are capitalized, so keep that in mind.</li>
<li>Whitespace, numb...https://codegolf.codidact.com/posts/284191Reverse your quine [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-09-14T12:52:01Z2023-07-06T13:31:57Z<h1>Challenge</h1>
<p>Write a program that prints its reversed self. For example, if your code is</p>
<pre><code>foo()
</code></pre>
<p>Then it'll output:</p>
<pre><code>)(oof
</code></pre>
...https://codegolf.codidact.com/posts/284040Collatz conjecture; Count the tries to reach $1$ [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-09-07T08:50:52Z2023-07-06T13:31:18Z<h1>Background</h1>
<p>Check out <a href="https://www.youtube.com/watch?v=094y1Z2wpJg">this video on the Collatz conjecture</a>, also known as A006577<sup class="footnote-ref"><a id="fnref1" href=...https://codegolf.codidact.com/posts/283948Define a mathematical expression in English [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-09-03T02:26:58Z2023-07-06T13:30:54Z<h1>Background</h1>
<p>Inspired by <a href="https://codegolf.codidact.com/posts/283865">this challenge that is also a mathematical English translator</a>.</p>
<h1>Challenge</h1>
<p>Write a progr...https://codegolf.codidact.com/posts/284407Operation "Find The Operator" [released]General Sebast1anhttps://codegolf.codidact.com/users/541142021-09-30T12:10:25Z2023-07-06T13:29:29Z<h1>Challenge</h1>
<p>Make a program that takes input of 3 non-negative integers: a result and 2 other values that once calculated results to the 3rd value.</p>
<ul>
<li>The program must figure ...https://codegolf.codidact.com/posts/279148Evaluate a univariate polynomial [FINALIZED]moonyhttps://codegolf.codidact.com/users/535042020-11-13T19:46:30Z2023-06-19T10:26:35Z<h1>Challenge</h1>
<p>Given a list of n numbers and x, compute $a + bx^1 + cx^{2} + zx^{n-1}$, where a is the first value in the list, b is the second, etc. n is at most 256 and at least 0. The i...https://codegolf.codidact.com/posts/279563Given the preorder and the inorder of a tree, output the postorder [FINALIZED]Hakerh400https://codegolf.codidact.com/users/535792020-11-25T09:42:04Z2023-06-19T10:26:29Z<h3>Definitions</h3>
<p>A binary tree is either a <code>null</code> (leaf), or an object (node). A node contains a value (non-negative integer) and two pointers (left and right) to two separate bi...https://codegolf.codidact.com/posts/279684Output 256 in many different ways [FINALIZED]dzaimahttps://codegolf.codidact.com/users/535012020-12-02T08:23:56Z2023-06-19T10:26:23Z<h2>Challenge</h2>
<p>Write as many functions, programs, or snippets of code, that result in 256. Your score is the number of separate solutions submitted in an answer.</p>
<p>The challenge? The ...https://codegolf.codidact.com/posts/279666Generate Lewis Caroll's Jabberwocky [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562020-12-01T17:52:18Z2023-06-19T10:26:18Z<p>The task is to generate the text of Lewis Caroll's Jabberwocky.</p>
<p>The text, quoted from <a href="https://en.wikipedia.org/wiki/Jabberwocky">Wikipedia,</a> is as follows (I've replaced a no...https://codegolf.codidact.com/posts/280551Write a Deadfish Interpreter[FINALIZED]Razetimehttps://codegolf.codidact.com/users/533102021-01-22T08:13:37Z2023-06-19T10:26:13Z<p><em>A rewrite of <a href="https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter">this question</a> with a simpler input format and guidelines.</em></p>
<h...https://codegolf.codidact.com/posts/282319Shuffle a subset of a list [FINALIZED]userhttps://codegolf.codidact.com/users/538372021-06-22T23:31:11Z2023-06-19T10:26:08Z<p><a href="https://codegolf.codidact.com/posts/282497">Posted</a></p>
<p><sup>Idea shamelessly stolen from <a href="https://chat.stackexchange.com/transcript/message/58238435#58238435">caird</a> ...https://codegolf.codidact.com/posts/282431Add two negabinary integers [FINALIZED]Moshihttps://codegolf.codidact.com/users/531962021-06-28T04:00:36Z2023-06-19T10:26:02Z<h2>About Negabinary</h2>
<p>Negabinary means base negative two (-2). That is, the $n$th place value is determined by $(-2)^n$.</p>
<p>Negabinary numbers can be evaluated just like any other base...https://codegolf.codidact.com/posts/283175Reduce over the range [1..n] [FINALIZED]userhttps://codegolf.codidact.com/users/538372021-08-06T21:41:01Z2023-06-19T10:25:57Z<h1>Task</h1>
<p>I often need to find the factorial of a number or the sum of all numbers up to a number when cheating on math tests. To help me with this, your task is to write $F$, a generalized...https://codegolf.codidact.com/posts/283108Are All Elements Equal?[FINALIZED]Razetimehttps://codegolf.codidact.com/users/533102021-08-04T17:15:09Z2023-06-19T10:25:52Z<h1>Challenge</h1>
<p>Given a list of integers >= 0 , check if all of them are equal.</p>
<h1>Tests</h1>
<pre><code>[1,1,1,1,1] -> true
[0,1,1,6,7] -> false
[1] -> true
...https://codegolf.codidact.com/posts/283603Multiply two strings [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-08-19T20:13:16Z2023-06-19T10:25:45Z<p>Given two strings, I define their product as follows:</p>
<ul>
<li>
<p>If any of the two strings is empty, the product is the empty string.</p>
</li>
<li>
<p>If the second string consists ...https://codegolf.codidact.com/posts/284029Repeat the characters [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-09-07T06:26:43Z2023-06-19T10:25:39Z<p>Given a string and a non-negative integer $n$, output a new string in which each character is repeated $n$ times.</p>
<p>Test cases:</p>
<pre><code>"abc", 1 -> "abc"
"Hello", 0 -> "...https://codegolf.codidact.com/posts/284136Decode periodic decimal fractions [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-09-11T08:45:07Z2023-06-19T10:25:34Z<p>Rational numbers in decimal representation can have an infinite periodic part. One common way to write this down is to repeat the periodic digits and then add three dots. Numbers without those t...https://codegolf.codidact.com/posts/284221The Ludic Numbers[FINALIZED]Razetimehttps://codegolf.codidact.com/users/533102021-09-17T07:19:21Z2023-06-19T10:25:29Z<p>The Ludic Numbers are a sequence that pops up when you apply the sieve of eratosthenes to the natural numbers, completely removing the numbers every iteration.</p>
<p>Here is how they are gener...https://codegolf.codidact.com/posts/283865Convert integer to English [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-08-31T09:27:26Z2023-06-19T10:25:23Z<p>Given a non-negative integer up to $999\\,999\\,999$, write it in English.</p>
<p>The input number can be in any form other than English (though you'll typically want to use the native integer ...https://codegolf.codidact.com/posts/284339Encode and decode floating point integers [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-09-25T10:05:55Z2023-06-19T10:25:14Z<p>Imagine you have only one byte (8 bits) to store a value, but need to store values from $0$ to $4032$. Impossible, until you are also told that an error of 1/64 of the exact value does not matte...https://codegolf.codidact.com/posts/284397Find good coalitions [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-09-29T16:45:23Z2023-06-19T10:25:07Z<p>As you might know, there were elections in Germany, and now the parties have to form a government coalition. Let's help them with it!</p>
<p>A good coalition has the strict majority of seats (t...https://codegolf.codidact.com/posts/279407Run-length encode a byte sequence [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562020-11-20T14:50:06Z2023-06-19T10:25:02Z<p>Run-length encoding is a simple compression technique which compresses sequences of repeating identical bytes.</p>
<p>The encoding rules for this task are as follows:</p>
<p>Any sequence of $n...https://codegolf.codidact.com/posts/284501Implement Rule 110 [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-10-06T09:32:54Z2023-06-19T10:24:56Z<p><a href="https://en.wikipedia.org/wiki/Rule_110">Rule 110</a> is a Turing complete cellular automaton. It is defined as follows:</p>
<p>Take as initial value a sequence of symbols that's infini...https://codegolf.codidact.com/posts/284852Golf golf challenge [FINALIZED]Lundinhttps://codegolf.codidact.com/users/81762021-11-12T13:34:58Z2023-06-19T10:24:50Z<p>The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line:</p>
<ul>
<li>The first number is the <strong>par</strong> of t...https://codegolf.codidact.com/posts/284777Find the IP address class [FINALIZED]Razetimehttps://codegolf.codidact.com/users/533102021-11-05T13:39:51Z2023-06-19T10:24:45Z<h1>Task</h1>
<p>Given an IP address as a string, find its <a href="https://www.guru99.com/ip-address-classes.html">IP address class.</a></p>
<p>For reference, here is a table:</p>
<table style=...https://codegolf.codidact.com/posts/285340Determine whether an integer is square-free [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562021-12-20T18:06:15Z2023-06-19T10:24:38Z<p>An integer is called square-free if it is not a multiple of a perfect square other than 1. For example, 42 is square-free, but 44 is not because it is a multiple of the perfect square 4 = 2².</p...https://codegolf.codidact.com/posts/285263Keyword golfing [FINALIZED]Lundinhttps://codegolf.codidact.com/users/81762021-12-15T11:45:04Z2023-06-19T10:24:32Z<p>Many programming languages have the concept of <em>keywords</em>, special syntax items that are not just identifiers reserved by some library, but words reserved by the language itself.</p>
<p>...https://codegolf.codidact.com/posts/286240Looping counter [FINALIZED]celtschkhttps://codegolf.codidact.com/users/80562022-04-13T07:40:54Z2023-06-19T10:24:15Z<h1>Looping counter</h1>
<p>Create an infinite loop that outputs lines of asterisks, with each line containing one more asterisk. Instead of the asterisk, any printable, non-whitespace character c...https://codegolf.codidact.com/posts/279482The Camelot Wheel [FINALIZED]Quintechttps://codegolf.codidact.com/users/535032020-11-23T22:43:40Z2023-06-19T10:23:59Z<p>Given a musical key, output its number and letter on the <a href="https://mixedinkey.com/harmonic-mixing-guide/">Camelot Wheel</a> (shown below).</p>
<p><img alt="Camelot Wheel" src="https://co...https://codegolf.codidact.com/posts/280673Create an Alphabet Diamond [FINALIZED]dzaimahttps://codegolf.codidact.com/users/535012021-02-05T10:19:13Z2023-06-18T10:11:04Z<h2>Challenge</h2>
<p>Output the following text:</p>
<pre><code class="language-text"> A
ABA
ABCBA
...https://codegolf.codidact.com/posts/288496Label the hinged tetrominoes - [FINALIZED]trichoplaxhttps://codegolf.codidact.com/users/538902023-06-17T10:50:04Z2023-06-17T17:20:12Z<h1>Now posted: <a href="https://codegolf.codidact.com/posts/288502">Label a hinged tetromino</a></h1>
<hr>
<p>Given a hinged tetromino, give it a unique, consistent label.</p>
<h2>Tetrominoes</...