text
stringlengths
180
608k
[Question] [ The twelve-balls problem is a famous problem where you are given twelve balls, one of which is a different weight, but you don't know whether it is heavier or lighter than the other balls. Using only three weighings of a two-sided scale, it is possible to find the differently weighted ball, *and* det...
[Question] [ ## Turing Machine Preliminaries A Turing machine is specified by the following data * A finite set of symbols S = \$\{s\_1,s\_2,...\}\$ * A finite set of states M = \$\{m\_1,m\_2,...\}\$ * A partially defined function $$T : M \times S \to S \times \{\mathrm{left},\mathrm{right}\} \times M $$ Any enco...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/210638/edit). Closed 3 years ago. [Improve this question](/posts/210638/edi...
[Question] [ # Definition The infinite spiral used in this question has `0` on the position `(0,0)`, and continues like this: ``` 16-15-14-13-12 | | 17 4--3--2 11 | | | | 18 5 0--1 10 | | | 19 6--7--8--9 | 20--21... ``` It is to be interpreted as a Cartesian plane. For example, `1`...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 5 years ago. [Improve this que...
[Question] [ Back to back challenges I guess. Hopefully this one is more clear than the last. # Background I was playing around with Goldbach's conjecture, and decided to plot evens (on the x-axis) vs the number of ways that two primes could be found to sum to a given even on the y axis. The two plots I've made b...
[Question] [ [Ethereum](https://www.ethereum.org/) is a blockchain platform. It has its own native cryptocurrency, ether, but in this challenge, we'll be focusing on its ability to run smart contracts. The [ERC-20 standard](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md) describes an i...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/65159/edit). Closed 2 years ago. [Improve this question](/posts/65159/edit)...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 7 years ag...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 9 years ago. [Improve this que...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/15581/edit). Closed 6 years ago. [Improve this question](/posts/15581/edit)...
[Question] [ Output all 95 bytes from `0x20` to `0x7E` inclusive (printable ASCII including space), in any order, each at least once. The source code of your program must use all of those bytes, each at least once. * Your program must be irreducible (meaning you cannot strictly remove some characters from the pro...
[Question] [ **Program:** To count the sum of all Unicode characters of a given input. (No need to display the output. The final answer can be calculated in any base no need to convert back to hexadecimal.) **Test case** : XyZ= 0058+0079+005A=012B **Condition:** If the program is inputted, then its output must be...
[Question] [ # Input An integer \$n\$ greater than or equal to 1. # Output The number of bits in the binary representation of the integer that is the product of the first \$n\$ primes. # Example The product of the first two primes is 6. This needs 3 bits to represent it. Given unlimited memory and time your code ...
[Question] [ **Problem:** In your choice of language, write the shortest function that returns the floor of the base-2 logarithm of an unsigned 64-bit integer, or –1 if passed a 0. (Note: This means the return type must be capable of expressing a negative value.) **Test cases:** Your function must work correctly ...
[Question] [ Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line. So the end-result becomes: ``` cccccccccc oooooooooooo nnnnnnnnnnnnnn eeeeeeeeeeeeeeee mmm...
[Question] [ Use any programming language to display "AWSALILAND" in such a way, so that each letter is in a new line and repeated as many times as its position in the English alphabet. For example letter, (A) should be displayed just once because it is the first letter of the alphabet. Letter D should be display...
[Question] [ Good Evening Golfers, Your challenge, this evening, is logarithmic, and (as Abed would put it) "Meta" Your goal is to write a program that takes an input from stdin or the command line, and returns the logarithm of that number, in the base of the length of your program in bytes. So, if your program ...
[Question] [ (Previously on "Print the \_\_ without using \_\_" ... [this one](https://codegolf.stackexchange.com/questions/36639/the-symbols-vs-the-letters) and [this one](https://codegolf.stackexchange.com/questions/35310/write-the-whole-of-the-holed-using-the-unholed)) The game of [Hearts](https://en.wikipedia...
[Question] [ For example, in traditional web hexadecimal, a certain base-16 number represents an RGB value. For example, 45A19C equals (69,161,156) in RGB. You'll be converting from that number to RGB value, however, instead you'll be given that number in base-10 rather than base 16. So in the example used above...
[Question] [ Your task is to get two numbers, and output the digit sum of them. We'll define digit sum as the following: * take the **decimal** (base 10) digits of each of them, and pad with 0s the shortest number (e.g. [1,9], [0, 7]) * sum the digits as vectors (e.g. [1, 16]) * convert the number back from base ...
[Question] [ **Schlosberg Numbers** In issue 5 of [Mathematical Reflections](https://www.awesomemath.org/mathematical-reflections/archives/), Dorin Andrica proposed the problem of characterising the positive integers n such that ![\sum_{k=1}^n \lfloor \frac{n}{k} \rfloor](https://i.stack.imgur.com/jQRsD.png) is ...
[Question] [ The challenge is this: You are given a url that is as follows: `http://sub.example.com/some/dir/file.php?action=delete&file=test.foo&strict=true` There can be either `http` or `https`, there can be any number of subdomains or directories, and the end file can have any name. You are to create a full ...
[Question] [ **This question already has answers here**: [Non-Unique/Duplicate Elements](/questions/60610/non-unique-duplicate-elements) (60 answers) Closed 5 years ago. So, I have an array ``` ['a', 42, 'b', 42, 'a'] ``` I want to alert users to the fact that 42 and 'a' appear in it twice. ``` some_functi...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 8 years ago. [Improve this que...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 7 years ag...
[Question] [ **PROBLEM** For a list of numbers, `list`: Find the *lowest possible* integer, `x`, which is optimally close to the whole number even-harmonics of the values in list. * `list` has a length of n, and all of the values in list are <= 2000 * `x` has a precision of 1.0 (integers only), and must be a valu...
[Question] [ A set of whole numbers (0-) will be given separated by a space. Some numbers will be missing between certain numbers in the set. Your job is to find the missing odd numbers between them. ## Conditions 1. The input will be a one line string. 2. Your code must left out a variable for inserting the inpu...
[Question] [ **This question already has answers here**: [Shortest code that raises a SIGSEGV](/questions/4399/shortest-code-that-raises-a-sigsegv) (84 answers) Closed 7 years ago. I come across a question in a coding competion "write a code that returns SIGSEGV(Segmentation fault ) " . Points were given ...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/197968/edit). Closed 4 years ago. [Improve this question](/posts/197968/edi...
[Question] [ ### The Challenge **Input:** alphanumeric string. You can assume that the string will only contain the characters [0-9A-Z]. This can come from a parameter, command line, or STDIN. Digits are always before letters in terms of the base. Think like an extended version of HEX. **Output** `X,Y` Such that ...
[Question] [ The problem is simple. Given a string such as `Hello World!` the program would output `8-5-12-12-15 23-15-18-12-4-!`. Any delimiters will do, (please specify what they are though) I just chose to use space between words and dashes between characters. The conversion is that all alphabetical characters...
[Question] [ > > **Note to Moderators and editors**: > This post's title is for effect and should not be changed. The misspelling is intentional and part of the challenge. > > > # Backstory The (stereo)typical bad SO question asks something along the lines of "plz send teh codez!" In other words, it asks som...
[Question] [ [On a standard 88 key piano, each key has a scientific name.](http://en.wikipedia.org/wiki/Piano_key_frequencies) The first three keys are A0, B♭0, and B0. The keys then proceed through C1, D♭1, D1, E♭1, E1, F1, G♭1, G1, A♭1, A1, B♭1, B1, and start over again at C2. This continues up through B7, and ...
[Question] [ Given an array of integers as input(including negative integers), find all (can include duplicates) permutations that **do not** have the same number next to each other, then print them all out. If no permutations were found, print Nothing or return an empty list or any consistent output indicating...
[Question] [ You work for a social media platform, and are told to create a program in a language of your choice that will automatically flag certain post titles as "spam". Your program must take the title as a string as input and output a [truthy](https://codegolf.meta.stackexchange.com/a/2194) value if the titl...
[Question] [ In this challenge you have to find out which nth second it is now in this year, current date and time now. Or in other words, how many seconds have passed since New Year. An example current Date is (it's not given, you'll have to find the current Date): ``` March 5, 2021 1:42:44 AM ``` For which the ...
[Question] [ John, a knight wants to kill a dragon to escape the castle! The dragon has `A` heads and `B` tails. He knows, that: * if you cut off one tail, two new tails grow * if you cut off two tails, one new head grows * if you cut off one head, one new tail grows * if you cut off two heads, nothing grows To d...
[Question] [ ## Challenge For a given positive integer \$n\$: 1. Repeat the following until \$n < 10\$ (until \$n\$ contains one digit). 2. Extract the last digit. 3. If the extracted digit is even (including 0) multiply the rest of the integer by \$2\$ and add \$1\$ ( \$2n+1\$ ). Then go back to `step 1` else mo...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/113134/edit). Closed 6 years ago. [Improve this question](/posts/113134/edi...
[Question] [ **(spoilers on decade-old TV show below)** In the HBO show "The Wire", the dealers use a system of encoding phone numbers where they "jump the 5" on the number pad. ``` +-----------+ | 1 | 2 | 3 | +-----------+ | 4 | 5 | 6 | +-----------+ | 7 | 8 | 9 | +-----------+ | # | 0 | * | +-----------+ ``` A...
[Question] [ Write a function (or macro) that returns true **if and only if** at least one of its arguments contains a call to the function itself and **false otherwise**. For example: ``` int a=function(); //a==false int b=function(0); //b==false int c=function(function(0)); //c==true int d=function(3*function(1...
[Question] [ Two numbers are coprime if their greatest common divisor is 1. Given a positive integer **N**, your task is to compute the first **N** terms of [OEIS A061116](http://oeis.org/A061116), which is the sequence of positive integers higher than 1 that are coprime to all their *decimal* digits. Here are th...
[Question] [ The [MMIX](https://en.wikipedia.org/wiki/MMIX) architecture is a fairly simple big-endian RISC design. It has a couple of interesting features, one of them is the `MXOR` instruction, which is what you should implement. The `MXOR` instruction interprets its arguments (two 64-bit registers) as two 8×8 ...
[Question] [ **INPUT:** * 10 random numbers * each number is greater than 0 and less than 100 * list of numbers is presorted, lowest to highest * the list will not contain any duplicate numbers **CHALLENGE:** Write a function that would take in the numbers, and return the count of the longest group of consecutive...
[Question] [ # Challenge **In this challenge**, all numbers are in \$\mathbb{N}\_0\$. Create a function or program that, when given a number \$N\$ and a tuple of \$k\$ numbers \$(n\_i)\$ (all ≤ \$N\$), returns the number of ways \$N\$ can be written as a sum of \$k\$ integers (\$x\_1 + x\_2 + ... + x\_k\$) such t...
[Question] [ **This question already has answers here**: [Maximum sub-array](/questions/138697/maximum-sub-array) (26 answers) Closed last year. Let's say you are given an integer array. Create a function to determine the largest sum of any array's adjacent subarrays. For instance, the contiguous subarray ...
[Question] [ This is my first time here at Code Golf SE so feel free to add your input/advice/suggestions to improve my post if necessary. The week after my computer science exam, the solutions were publicly published. One problem had a 45 line example solution but my solution was only 18 lines, (which I was very...
[Question] [ **This question already has answers here**: [Code that will only execute once](/questions/28672/code-that-will-only-execute-once) (82 answers) Closed 6 years ago. # Challenge Create a program that, when run, changes the contents of the source file. This means that you can delete/add/change cha...
[Question] [ So I was playing around with my compose key, and found some cool things, one of them being that by pressing `compose + ( + alphanumeric + )`, you get that character inside a bubble, like so: `ⓐ`. Your task in this challenge is simple, to convert ordinary text to bubble letter text. Here are the ascii...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/19727/edit). Closed 7 years ago. [Improve this question](/posts/19727/edit)...
[Question] [ **This question already has answers here**: [Sum of primes between given range](/questions/113/sum-of-primes-between-given-range) (61 answers) Closed 6 years ago. The primorial of a number is the product of all the primes until that number, itself included. Take a number from `STDIN` as the in...
[Question] [ Your task is given an input string of the full/short name of a CS:GO ([Counter-Strike: Global Offensive](https://en.wikipedia.org/wiki/Counter-Strike:_Global_Offensive), a computer game) rank return an integer from 1-18 representing the rank number. A higher number means you are a higher rank and so ...
[Question] [ **Challenge: Read a string from user, print number of each vowel, then place all remaining chars in a line. Shortest answer wins!** Output must look like this: > > Enter String: *Input* > > > Vowel Count: a: *#*, e: *#*, i: *#*, o: *#*, u: *#* > > > Remaining characters: *Vowel-less Input* > > ...
[Question] [ # The challenge Insert one string into another at a given index. Given a string input in the format: ``` #:Pattern:Word ``` Where: * `#` is a positive integer marking the index * `Pattern` is the string (whose length is undefined) to insert * `:` is a delimiter * `Word` is the string to insert into. ...
[Question] [ **Objective:** The objective is to calculate e^N for some real or imaginary N (e.g. 2, -3i, 0.7, 2.5i, but not 3+2i). This is code golf, so, shortest code (in bytes) wins. So, for example: 1. N = 3, e^N = 20.0855392 2. N = -2i, e^N = -0.416146837 - 0.9092974268i The letter `i` shouldn't be capitaliz...
[Question] [ **Generate math problems (addition, subtraction, or multiplication) using numbers 0-10. Provide feedback on whether the user was right or wrong and show a score.** Specifics: * Must generate addition, subtraction, or multiplication problems * Numbers used must be 0-10 * Each problem must be equally l...
[Question] [ My user id is `106959` How to check if the number is Fmbalbuena number? First Step: Check if the number of digits is a multiple of 3: `6` = `3` \* `2` Second step: Split the digits into even thirds: `106959 -> 10 69 59` Third step: Subtract the first set of digits from the second modulo 10: `6` - `1`...
[Question] [ Odd prime numbers are either in the form of `4k+1` or `4k+3` where `k` is a non-negative integer. If we divide the set of odd prime numbers into two such groups like this: ``` 4k+3 | 3 7 11 19 23 31 43 47 59 67 71 | 4k+1 | 5 13 17 ...
[Question] [ ## Your task You must write a program, to print a **reverse Fibonacci series**, given a number. ## Input A **non-negative** integer ***N***. ## Output You must output all the Fibonacci numbers from ***Fk*** to ***F0***, where ***k*** is the smallest non-negative integer such that ***Fk*** ‚â§ ***N***...
[Question] [ You will be given a positive integer as input. The integer is the board of a seesaw. Th integer will not have leading zeroes. You may take this input however you like. Your task is to output the location of the pivot point of this seesaw, such that the board would balance. A board balances if the mom...
[Question] [ Your task is to devise a programme that extracts the bits, in order, represented by the first argument based on the set bits represented by the second argument (the mask). **Formal Definition:** * Let the first argument `x` represent the binary string `S=(xn)(xn-1)...(x1)` with `n>=0` and `x1` being...
[Question] [ One reason why [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) is the best date string format, is that you can simply append as much precision as you like. Given 2 integers representing seconds and nanoseconds that have passed since `1970-01-01T00:00:00`, return an ISO8601 string as described below...
[Question] [ Given a string containing only letters (case-insensitive), split it into words of uniformly random lengths, using the distribution below, with the exception of the last word, which can be of any valid length (1-10). Your output is these words, as a space-separated string (`"test te tests"`), an array...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/1771/edit). Closed 7 years ago. [Improve this question](/...
[Question] [ Given a positive input \$n\$, output a random pair of primes whose difference is \$n\$. It's fine if there's another prime between them. Every pair should possibly appear and the program should have zero possibility to fall into infinite loop. It's promised that such pair exist, but not always infini...
[Question] [ Leonhard Euler wants to visit a few friends who live in houses *2, 3, ..., N* (he lives in house 1). However, because of how his city is laid out, none of the paths between any houses form a loop (so, the houses exist on a graph which is a tree). He gets bored easily but if he visits his friends in a...
[Question] [ ## Introduction Some time ago, I need to write function which split string in some specific way. At the first look, task looks trivial, but it was not so easy - especially when I want to decrease code size. ## Challenge As example we have following input string (it can be arbitrary) > > Lorem ipsum ...
[Question] [ And then the King said: *You fought bravely, Knight, and your deed will not be forgotten for centuries. For your valor I grant you this castle and the lands around it. Things rush me, and I can not take you to the castle. Therefore, I will give you the way from this place to the castle. Now go and co...
[Question] [ It turns out that my toaster is a tad broken. It lost WiFi (You know, it's one of those newfangled smart toasters), and its been going bonkers! Since it no longer works, I've been having to hack into my breakfast's source code and run `Plate.bread.toastAs(3);` every morning. Will you help? My toaster...
[Question] [ **This question already has answers here**: [Fill in the next numbers](/questions/243764/fill-in-the-next-numbers) (30 answers) Closed 1 year ago. You are given a list of 2-tuples of positive integers, of the form: `a1 b1, a2 b2, ..., an bn` In other words, the 2-tuples are comma-separated, an...
[Question] [ ## Input: A decimal ## Output: The input truncated **How to truncate them?** The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in consecutive order. The two step-by-step examples below should clarify what I mean by that: *Exa...
[Question] [ The goal of this challenge is to reduce a list of string to a shorter more general list of string. # Input The Input is provided with space between the string (a b c) or in list form (["a","b", "c"]). It's a list list of string that can be of the following form : * aaa * aaaX * aaaX/Y With **aaa** an...
[Question] [ Your program's input is a string containing whitespaces, parentheses, and other characters. The string is assumed to be parenthesed correctly, i.e. each right parenthesis matches a unique left parenthesis and vice versa : so the program is allowed to do anything on incorrectly parenthesed strings, su...
[Question] [ A partition of a list \$A\$ is a way of splitting \$A\$ up into smaller parts, concretely it is list of lists that when concatenated gives back \$A\$. For example `[[1],[2,3],[5,6]]` is a partition of `[1,2,3,5,6]`. The trivial partition is a partition that "splits" the list into only one piece, so `...
[Question] [ > > [Related](https://codegolf.stackexchange.com/questions/135484/calculating-bpm-with-inputs) as it requires you to measure the time between the first and last input. But here you're required to count how many inputs in a period of time. > > > I was assigned a task to stand by a gate and count h...
[Question] [ i.e each byte appears in a different ANSI shell colour. # Rules * Resetting the color of the shell after output is not required * Must be output in STDOUT or the primary colour text output of your language. * Must be done programmatically (iterating through each color and letter of the string induvid...
[Question] [ *You don't need to know these languages to participate. All necessary information has been provided in this question.* You should write a program or function which given a [brainfuck (BF)](http://esolangs.org/wiki/Brainfuck) code as input outputs its [tinyBF](http://esolangs.org/wiki/TinyBF) equivale...
[Question] [ Given an alphabet and a string, your job is to create the [Lempel–Ziv–Welch compression](http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch) of the string. Your implementation can either be a function with two parameters and a return value, or a full program that uses stdin and stdout. #...
[Question] [ *Related: [Sort these bond ratings](https://codegolf.stackexchange.com/q/71723/73593)* [Credit rating agencies](https://en.wikipedia.org/wiki/Credit_rating_agency) assign ratings to bonds according to the credit-worthiness of the issuer. The rating business is mostly controlled by ["Big Three" credit...
[Question] [ **This question already has answers here**: [Substitution cipher [duplicate]](/questions/77899/substitution-cipher) (13 answers) Closed 2 years ago. Given a permutation of the alphabet and an input string, encrypt the input string by replacing all characters with the one's you've been given. T...
[Question] [ **This question already has answers here**: [Play the "bzzt" game](/questions/32267/play-the-bzzt-game) (82 answers) Closed 7 years ago. This is my first code golf exercise for you: Your input is two integers n and k. You can assume n >= 1 and k >= 1 You have to output all numbers from 1 to n ...
[Question] [ As a programmer or computer scientist one might encounter quite a lot of trees - of course not the woody growing-in-the-wrong-direction kind, but the nice, pure mathematical kind: ``` *<- root (also a node) /|\<- edge * * *<- inner node | / \ * * *<- leaf (also a node) | * ``` Naturally ove...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/7293/edit). Closed 6 years ago. [Improve this question](/posts/7293/edit) ...
[Question] [ Implement a function that takes a list that consists of 0, 1 or 2, the list is called "pattern". Your job is to return all possible lists that match the pattern. * 0 matches 0 * 1 matches 1 * 2 matches 0 and 1 Examples: ``` f([0, 1, 1]) == [[0, 1, 1]] f([0, 2, 0, 2]) == [[0, 0, 0, 0], [0, 1, 0, 0], [...
[Question] [ Given two non-empty 01 strings, check if there is string containing both given strings, and their first appearance end at same position. Test cases: ``` 01, 1 => true (01) 0, 00 => false (0 would at least come 1 character earlier) 01, 11 => false (can't meet on same position) 01, 0 => false (can't me...
[Question] [ I am quite surprised that [a variant of linear regression](https://codegolf.stackexchange.com/questions/106260/linear-regression-on-a-string) has been proposed for a challenge, whereas an estimation via ordinary least squares regression has not, despite the fact the this is arguably the most widely u...
[Question] [ The partitions of an integer **N** are all the combinations of integers smaller than or equal to **N** and higher than **0** which sum up to **N**. A relatively prime partition is an integer partition, but whose elements are *(overall)* coprime; or in other words, there is no integer greater than 1 w...
[Question] [ A [Directed Acyclic Graph (DAG)](https://en.wikipedia.org/wiki/Directed_acyclic_graph) is a type of graph that has no cycles in it. In other words, if there is a link from node A to node B, there exists no path from B to A (via any nodes). # Challenge Determine whether the directed graph given as inp...
[Question] [ My Python 3 function `golf(...)` should take a list of lists of lists of strings representing a solid cube and return whether there are any places in which two equal strings are directly next to each other on the x, y or z axis (not diagonally). If there are no adjacent duplicates, True shall be re...
[Question] [ The standard long addition method: > > The standard algorithm for adding multidigit numbers is to align the addends vertically and add the columns, starting from the ones column on the right. If a column exceeds ten, the extra digit is "carried" into the next column. ([wikipedia](https://en.wikipedi...
[Question] [ James Bond is about to start a new mission and you are his computer scientist friend. As Tic Tac Toe is becoming more and more popular you decide that nothing would be more underhanded than a **Tic Tac Toe encoder/decoder™**. For each line the decoder will follow the following steps: * Convert from ...
[Question] [ Given two numbers r and n on separate lines, write a program to print n natural numbers starting from 1 onwards, excluding the r-th powers. For example, If `r=2` and `n=10`, the results would be `2,3,5,6,7,8,10,11,12,13` 4 and 9 were excluded because 4 is `2^2` and 9 is `3^2` ``` Sample Input 2 10 S...
[Question] [ [Cops thread](https://codegolf.stackexchange.com/questions/241380/find-my-other-token-cops) Robbers, Write a program in the cop's language using the cop's P string and your own S string, and the amount of each of them specified in the cop's post. Your S string may not exceed the cop's S string in byt...
[Question] [ I have 2 inputs: 1 single number and some numbers separated by whitespace: ``` 1 1 2 3 4 5 ``` I want to loop over the second input, and I don't need the first input. I did this, which works: ``` input() for x in input().split():somecode() ``` But can I go directly to the second input without doing t...
[Question] [ ## Task Given an input, evaluate it as a mathematical equation following the order of operations. But, instead of the using PEMDAS, we drop the parentheses and exponentiation and introduce spaces - SMDAS - spaces, then multiplication & division, then addition & subtraction. ### How does that work? Ev...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/119226/edit). Closed 6 years ago. [Improve this question](/posts/119226/edi...
[Question] [ [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) is defined as [![Gamma function definition](https://i.stack.imgur.com/ES8hs.png)](https://i.stack.imgur.com/ES8hs.png) It is a well-known fact that for positive integers it coincides with a properly shifted factorial function: `Γ(n) = (n ...
[Question] [ You should write a program or function which outputs or returns the sum of the digits in base `b` representation of the first `n` natural power of `a` in ascending order. Example for `a = 2`, `b = 3` and `n = 4` ``` The base10 numbers are 2^0, 2^1, 2^2 and 2^3. Their base3 representations are 1, 2, 1...
[Question] [ This is an optimization/algorithms challenge. Given two sets of points X and Y, which are to be thought of as points on a circle of circumference T, the challenge is to find the rotation which minimizes the distance from the set X to the set Y. Here the distance is just the sum of the absolute distan...