instruction
stringlengths
34
53.1k
Write a program or a function to print the following cube (if you allow me to call it so) in different sizes: ^L^L^L^L^L^L^L^L^L^L^L //^L^L^L^L^L^L^L^L^L^L^L ////^L^L^L^L^L^L^L^L^L^L^L //////^L^L^L^L^L^L^L^L^L^L^L ////////^L^L^L^L^L^L^L^L^L^L^L //////////^L^L^L^L^L^L^L^L^L^L...
Edit (Jan 24/2021): The original specification for the challenge had a few problems. Underneath the original text, I have added alternate conditions that were suggested by @caird-coinheringaahing (thanks for the tips). There is a gameshow in the UK called "Countdown", and a parody called "8 out of 10 Cats does Countdow...
Introduction A "lobster number", by my own designation, is a number that contains within itself all of its prime factors. The "lobster" description was inspired by the recent question "Speed of Lobsters". The basic idea is that each prime factor can be made by lobsters munching away digits of the number until you are...
In this challenge, bots (consisting of JS functions) move around an infinite factory (playing field), collecting characters. These characters can be used to build worker bots, or dropped for other bots to pick up. This challenge is a modified redo of Bot Factory KoTH, which was broken by a mistake in the spec. Results ...
zipwith is a functional construct that takes three arguments: one binary function and two lists of the same length, and returns a single list where each element is constructed by applying the binary function to each pair of elements from the two lists: zipwith (a+b) [1,2,3] [4,5,6] = [5,7,9] You are to take a black-bo...
Input: Ten unique integer coordinates, between (0,0) and (100,100). Output: The coordinates arranged in the order/an order such that a path drawn between the coordinates in that order is the shortest path possible. This is code golf so the shortest code wins!
Background An L-shape is defined as a polyomino which can be made by extending two rectangular legs in orthogonal directions from a full square (called a pivot). The size of the square should be at least 1, and the lengths of the two legs should also be at least 1. These are some examples of L-shapes: Pivot size 1, two...
Here is the problem, for which I can only think of an iterative solution and have not found a closed formula: You need to paint a house with R rooms. For each room there are four walls and one ceiling, which all have the same dimensions and need C coats of paint. You can't paint the next coat until the previous one ha...
Peano numbers represent nonnegative integers as zero or successors of other Peano numbers. For example, 1 would be represented as Succ(Zero) and 3 would be Succ(Succ(Succ(Zero))). Task Implement the following operations on Peano numbers, at compile time: Addition Subtraction - You will never be required to subtract a ...
Heavily based on this closed challenge. Codidact post, Sandbox Description A Sumac sequence starts with two non-zero integers \$t_1\$ and \$t_2.\$ The next term, \$t_3 = t_1 - t_2\$ More generally, \$t_n = t_{n-2} - t_{n-1}\$ The sequence ends when \$t_n ≤ 0\$. All values in the sequence must be positive. Challenge Gi...
You are to write a program which generates random integers between \$0\$ and \$99\$ inclusive, outputting each integer in turn, until \$0\$ is generated. You may choose which single-order random distribution (uniform, binomial, Poisson etc.) you use so long as each integer has a non-zero chance of being generated and i...
Introduction A quine is a program that outputs its own source code. For example, a well-known Python quine is _='_=%r;print(end=_%%_)';print(end=_%_). Running it outputs _='_=%r;print(end=_%%_)';print(end=_%_), therefore it is a valid quine. An error quine is similar to a regular quine, however it must output to STDERR...
Sandbox, Codidact A rewrite of this question with a simpler input format and guidelines. Challenge Deadfish uses a single accumulator, on which all commands are to be performed. It has the following commands: Command Description i increment the accumulator d decrement the accumulator s square the value of t...
Challenge The goal is to output Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. Context. (Maybe another interesting challenge could be printing all of the other examples? This would probably use similar logic but involve either a function or just a for loop.) Rule(s) You cannot output anything other t...
My stovetop has 10 (0 through 9) different settings of heat and a very odd way of cycling through them. It always starts at 0 When I hit plus it increments the number, unless the number is 9 in which case it becomes 0, or the number is 0 in which case it becomes 9. When I hit minus it decrements the number, unless t...
Based on the "Pretty Ugly" poem. Input consists of a number of stanzas (positive integer), and four arrays/lists of strings, called the "negatives", "negations", "positives", and "filler" sentences. You must output a "pretty ugly" poem with the specified number of stanzas. A stanza consists of a negative, negation, pos...
I made this because, although we have a bunch of other questions involving smiley faces, there is nothing for just printing an ASCII smiley face with as little code as possible. Anyway, print this exactly (Trailing spaces allowed): ********** ****************** ********************** ******* ****** ***...
Challenge: Given a list of non-negative integers, determine by how much you should increase each item to create the closest binary box with the resulting integer-list. What is a binary box? A binary box is where the first and last rows consists of 1-bits; the first and last columns consist of 1-bits; and everything els...
Background Fibonacci trees \$T_n\$ are a sequence of rooted binary trees of height \$n-1\$. They are defined as follows: \$T_0\$ has no nodes. \$T_1\$ has a single node (the root). The root node of \$T_{n+2}\$ has \$T_{n+1}\$ as its left subtree and \$T_n\$ as its right subtree. T0 T1 T2 T3 T4 O ...
Given a rod of length n inches and a list of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces. For example, if length of the rod is 8 and the values of different pieces are given as following, then the maximum obtainabl...
Challenge The challenge is to implement the bottom encoding (only encoding, not decoding). There is a wide variety of existing implementations in the bottom-software-foundation org. Bottom is a text encoding where each character is separated into multiple emoji. Unicode escape(s) Character Value U+1FAC2 200 ...
What is Permutation Coefficient Permutation refers to the process of arranging all the members of a given set to form a sequence. The number of permutations on a set of n elements is given by n! , where “!” represents factorial. The Permutation Coefficient represented by P(n, k) is used to represent the number of ways ...
Originally sandboxed by @xnor Left-or-right is a very simple language @xnor made up. Its expressions are made of arrows < (left), > (right), and parentheses. The goal is to evaluate an expression to either < or >. An expression A<B picks the left item A, while A>B picks the right one B. Think of < and > as arrows point...
Challenge Create a function or program that, when given an integer size, behaves the following way: If size is equal to 1, output ┌┐ └┘ If size is greater than 1, apply the following substitutions : Source Target ┌ ┌┐└┌ ┐ ┌┐┐┘ └ ┌└└┘ ┘ ┘┐└┘ Note: this is basically a Unicode box-drawing version of the...
Given a BF program consisting of only the characters +-[]<>., with the property that there's an equal number of < and > between every matching pair of []. You have to find the shortest program that can be achieved with the optimal memory layout (by rearranging the cells on the tape). If there are multiple such programs...
Given an array of integers, find "the next to the middle". The next to the middle is the smallest integer greater than the smallest among mean, median and mode of the given numbers, that is neither the mean, median or mode and is also contained in the array. For example, in the following array [ 7, 5, 2, 8, 0, 2, 9, ...
Output this 1364-digit base-10 number: 10346063175382775954983214965288942351853612536382034663905935101461222060548195774084941504127779027795484711048746289269095513027910438498906751225648197766590064457965461314130149942152545074712074006545797623075756579902190433531325851645586375231773037880535184421903026638874...
Whispers is February 2021's Language of the Month, so what tips do you have for golfing in it? Tips do not have to be specific to code-golf, so long as they apply to other types of challenges on the site. Tips should be at least somewhat specific to Whispers (e.g. "remove ignored code" is not an answer). Please post on...
Introduction git diff is a great way to export patches of the source code, and its outputs are colorized if you don't pass extra arguments to it. However, when you want to review the exported file with colored output, it would be pretty hard. colordiff is an option, but it acts like the diff program itself, also, it is...
One thing that is constantly frustrating when golfing ARM Thumb-2 code is generating constants. Since Thumb only has 16-bit and 32-bit instructions, it is impossible to encode every immediate 32-bit value into a single instruction. Additionally, since it is a variable length instruction set, some methods of generating ...
Repost and improvement of this challenge from 2011 A vampire number is a positive integer \$v\$ with an even number of digits that can be split into 2 smaller integers \$x, y\$ consisting of the digits of \$v\$ such that \$v = xy\$. For example: $$1260 = 21 \times 60$$ so \$1260\$ is a vampire number. Note that the dig...
When I was posting answers for the Husk Language of The Month thread, I realized it took more time to enter them in the thread than it took to actually write the answers. So, why not automate it? Write a program/function which inputs a language name, and displays all answers in that language during the current month so...
In the MMORPG Final Fantasy XIV, the Ninja class has the ability to use combinations of up to three handsigns (Ten, Chi and Jin) to perform a variety of ninjutsu skills. The skill you cast depends on the last sign used, and using two or more of the same sign makes the ninjutsu skill fail and puts a little bunny on your...
An unrooted binary tree is an unrooted tree (a graph that has single connected component and contains no cycles) where each vertex has exactly one or three neighbors. It is used in bioinformatics to show evolutionary relationships between species. If such a tree has \$n\$ internal nodes, it necessarily has \$n+2\$ leav...
In my previous bioinformatics challenge, I asked you to mutate a DNA sequence. This time, I'd like you to evaluate how likely a mutation, or a series of mutations, is. The two types of substitutions are transitions and transversions, and due to the chemical structure of DNA bases, transitions are more likely to occur t...
The challenge: compute the day of the week from a MM-DD representation of a day in this year (2021). However, you have to write your program in the following subset of Python: (I chose Python because it's popular and easy to understand even to the people who doesn't know the language. Obviously you can use another prog...
Given two strings a and b, count how many times b occurs as a substring in a, but only when it overlaps with another instance of b. (This means that 1 will never be a valid output, because in order for the substring to be strictly overlapping, there must be at least one other instance for it to overlap with.) Test case...
Given the following Python "reference implementation" of non-terminating FizzBuzz: i=1 while True: if i%15 == 0: print("FizzBuzz") elif i%3 == 0: print("Fizz") elif i%5 == 0: print("Buzz") else: print(i) i += 1 We can represent its output as an infinite array of char...
Given a 2-dimensional jagged array and a fill value, pad the array in both dimensions with the fill value to ensure that it is square and not jagged (i.e., all rows are the same length, and that length is the same as the number of rows). The fill values should always be added to the "edges", which may be the start or t...
You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now. Rules You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years. Standard...
You will need to evaluate the definite integral (bounded by \$a\$ and \$b\$) of a certain polynomial function that takes the form of: $$\int_a^b \left( k_n x^n + k_{n-1} x^{n-1} + \cdots + k_2x^2 + k_1x + k_0 \: \right) dx$$ Normally, this can be done using the fundamental theorem of calculus and power rules. For examp...
Background Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits. Given a positive integer \$N\$, the encoding algorithm is as follows: Start with a single zero in the output. If \$N=1\$, stop. Prepend the binary digits of \$N\$ to the current output. Let \$N\$ be ...
The program should start out with 2 separate files, here named "a" and "b". "a" and "b" should be what I am calling inverse quines: "a", when run, should output "b"'s source code, and "b", when run, should output "a"'s source code, for example: ./a #source code of b, optionally followed by newlines ./b #source code of ...
Left in sandbox for at least 3 days. I want to verify if this inequality is true: for \$n\geq4\$, if \$a_1,a_2,a_3,\dots,a_n\in R_+\cup\{0\}\$ and \$\sum_{i=1}^na_i=1\$, then \$a_1a_2+a_2a_3+a_3a_4+\dots+a_{n-1}a_n+a_na_1\leq\frac{1}{4}\$. Challenge Write a piece of program which takes an integer n as input. It does th...
Background This is loosely based on the now closed Kaomoji question asked a few hours ago. Kaomojis are sequences of characters designed to express a given emotion. In this code-challenge, you'll be writing a program that takes a Kaomoji as input, and must output the emotion expressed by the Kaomoji. Input A Kaomoji. I...
You have to print out your username, by only using the characters in your username. Standard loopholes are forbidden This is not code-golf, so shortest does not win Don't modify your username please And each language be used one time
Introduction Book cipher A Book cipher is a very unique method of a encipher. Here's how's it done: You have a book / a document or a article (something full of text, the more pages of text the better). You have a message to convey (a secret, of some sort) You simply-put read trough the text and the secret message (ma...
Challenge I've checked that there is a question Compute the Discrete Cosine Transform which is a competition for implementing a shortest solution to compute the one dimensional discrete cosine transform. The goal of this challenge is to implement a program to calculate three dimensional discrete cosine transform which ...
Looking at the following hackerrank problem: https://www.hackerrank.com/challenges/flatland-space-stations You are given a number n where cities can be at indices 0 to n-1 and also given an unsorted list of indices of cities where there are stations. The goal is to find the maximum distance from a city to a station. Fo...
Challenge In this simple challenge, you have to print the public IP address of google.com. Rules You have to output either the IPv6 or IPv4 address, and do it by somehow using internet. Output does not strictly need to be the IP address, your answer will be valid if the correct IP address is somewhere in the output, ...
Inspired from Is this site down or is it just me? Challenge You have to print if a website server is online or not, for you. Input The domain name, like codegolf.stackexchange.com Output 1/True if online 0/False if offline Rules Any kind of web access is allowed URL shorteners allowed Except 2 no. Rule, all standa...
!!!Batch is another derivative of the Windows Batch programming language, its wiki is here Your challenge is to create an compiler/translator that reads a !!!Batch program and returns a Windows Batch program. In !!!Batch each token braced in two question marks like ?!!!? is converted to another ASCII character, like '?...
Given two inputs, a number n and a dimension d, generate the nth d-dimensional pyramid number. That was confusing, let me try again. For d = 1, the numbers start 1,2,3,4,5 and is the number of points in a line n points long. For d = 2, the numbers start 1,3,6,10,15 and is the number of points in a triangle with side le...
Background Character classes are a standard way to indicate a set of characters to match in regular expressions. For example, the class [ab] matches a or b, [a-z] matches any lower case letter, and [^a] matches everything but a. For the purpose of this question, classes can contain: a sequence of characters to match, ...
While at work I spotted a nice and simple challenge. The job was to stock products in cargo units with a certain capability. Since an order can have various batches, coming in sequence from the production, we usually make a list of the pieces of those batches distributed in each cargo to make sure nothing is lost durin...
A binary relation on a set \$X\$ is simply a subset \$S \subseteq X \times X\$; in other words, a relation is a collection of pairs \$(x,y)\$ such that both \$x\$ and \$y\$ are in \$X\$. The number of different relations grows quickly with the size of the set: if \$X\$ contains \$n\$ elements, there are \$2^{n^2}\$ bin...
Introduction This challenge was originally the "Among Us" challenge in the "Misc" category of YASCON CTF 2020. (The link includes an answer to that challenge. Click at your own risk.) You're given a lot of files, 1 of which is different from every other files. Your job is to find that 1 different file. Challenge Input...
Related: Elias omega coding: encoding Background Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits. Given a stream of bits \$S\$, the decoding algorithm is as follows: If \$S\$ is empty, stop. Otherwise, let \$N=1\$. Read the next bit \$b\$ of \$S\$. If \$b=0\$...
Your task is to make a script with the shortest byte count, that reverses a word then replaces each letter with the next letter next in the alphabet. Examples: input: hi output: ji input: hello output: pmmfi input: test output: utfu A few notes: Should the letter's value be 27 (z+1), assume it is an a. Symbols, num...
I like anagrams. I like programs that reference their own source code. So this challenge combines them! Input. The input to the program could be anything, including letters, numbers, symbols, you name it. Output. A truthy value if the input's characters can be rearranged to give the source code, and a falsy value if th...
Adapted from tips for restricted-source in Python Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the zsh language. While we already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep within the ...
When I was a kid, there was a "really cool" shortcut to count to 100: 1, 2, miss a few, 99, 100 Output the exact string above, in the fewest characters possible, without using these characters: 0, 1, 2, 9
It's the end of the year, you and your friends have just received your grades and ranks for the GOLF101 class. On a chat group, everyone sends their grade and rank to see who's got the best one. Problem: someone is lying. Here is an excerpt from the chat: <A> I'm ranked 1 with a grade of 85. <B> Ranked 3, got 50. <C> R...
Powerful numbers are positive integers such that, when expressed as a prime factorisation: $$a = p_1^{e_1} \times p_2^{e_2} \times p_3^{e_3} \cdots \times p_k^{e_k}$$ all exponents \$e_1, e_2, ...\$ are greater than or equal to \$2\$. Note that the exponents do not include zero exponents, as exampled by \$200 = 2^3 \ti...
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 that \$n_i \le x_i \le N\$. The...
Print integers 0 to 100 (inclusive) without using characters 123456789 in your code. Separator of numbers can be comma or white space (by default <blank>, <horizontal tabulator>, <newline>, <carriage return>, <form feed> or <vertical tabulator>). Shortest code wins.
Given an array \$A\$ of positive integers between \$1\$ and \$9\$ inclusive and a positive integer \$n\$, remove all integers in \$A\$ which appear more than \$n\$ times. For example: [1,2,3,2,3,2,4,1,2], n = 2 Occurrence: 1 1 1 2 2 3 1 2 4 Keep? 1 1 1 1 1 0 1 1 0 Kept values: [1,2,3,2,3, 4,1 ]...
Background: For this challenge, a polynomial looks like this: $$P(x)=a_nx^n+a_{n-1}x^{n-1}+\dots+a_2x^2+a_1x+a_0$$ The degree, \$n\$, is the highest power \$x\$ is raised to. An example of a degree 7 polynomial would be: $$P(x)=4x^7+2x^6-7x^4+x^2-6x+17$$ All powers are integers \$n\ge0\$. This means \$x\$, \$-2\$, and ...
Oh, No! the sentences are out of balance. Quick! balance them. A word is defined as follows: A sequence of letters [A-Za-z] separated by any non-letter character ([0-9] ~+- etc.) A word is BaLanCeD if its capitalization is the same forwards as it is backwards. Given a sentence with words, balance each word by capita...
Your challenge: The code must print "Hello, World!" and nothing else. Your restrictions: Your program must satisfy these requirements: The program must be a pangram. It must use every character in printable ASCII, or, if you chose a particularly strange language, characters which are stored as one byte. You are allow...
A "qruine" if you will :) Design a QR code that legibly spells with its pixels (or the space between them) the text that it scans to. For example, this QR code scans to the letter A, and also spells out A in white: There are 4 categories, one for each mode of QR code: numeric, alphanumeric, byte, and kanji. Please sta...
I just created a language on the spot, and it's called "interpreter". Called as such because the only valid word is "interpreter"! A sample program in "interpreter" looks like this: interpreter interpreterinterpreter interpreterinterpreterinterpreter interpreterinterpreterinterpreterinterpreter interpreterinterpreterin...
Your task is to determine whether some arbitrary programming language has zero-indexed or one-indexed arrays based on sample inputs and outputs Inputs An array of integers with at least 2 elements A positive integer index The value of the array at that index Output One of four distinct values representing: One-index...
You have to write a program, if its source code is reversed, then it will error. For example, if your source is ABC, then reversing it and writing CBA should crash/throw an error. And ABC itself should be a vaild program (I mean your primary source should be a valid program). Output of the main source code can be empty...
This code-challenge is based on OEIS sequence A261865. \$A261865(n)\$ is the least integer \$k\$ such that some multiple of \$\sqrt{k}\$ is in the interval \$(n,n+1)\$. The goal of this challenge is to write a program that can find a value of \$n\$ that makes \$A261865(n)\$ as large as you can. A brute-force program ...
Background Network discovery tool Nmap takes a list of TCP/UDP port numbers as input and performs a security audit against the listed ports. The target port listing on the command line includes selected port numbers as strings separated by a comma. To make specifying big amounts of ports more convenient the tool also s...
You need to print A-Z like this: 1. A 2. B 3. C 4. D 5. E 6. F 7. G 8. H 9. I 10. J 11. K 12. L 13. M 14. N 15. O 16. P 17. Q 18. R 19. S 20. T 21. U 22. V 23. W 24. X 25. Y 26. Z But your source code cannot use 1,2,4,6. Trailing newlines in output allowed,, but leading ones not allowed. Standard loopholes apply, shor...
Your challenge is to write a Python program to print all the primes (separated by whitespace) less than a given integer N with an asterisk (*) next to each twin prime in ONE statement. A twin prime is a prime number that is either two more or two less than another prime. All output should be to stdout and input should ...
Your challenge is to write a program to print all the primes (separated by one or more whitespace characters) less than a given integer N with an asterisk (*) next to each twin prime. A twin prime is a prime number that is either two more or two less than another prime. (Hardcoding outputs is allowed, but it is not lik...
your challenge is to draw this ASCII art: | | |- - - - | | - - - | | | | | | | |- - -| |- - - | | | | | | | | | | | | | |- - - - |- - - |- - - - - - remember this is code golf meaning you have to answer in the leas...
Let \$\sigma(n)\$ represent the divisor sum of \$n\$ and \$\sigma^m(n)\$ represent the repeated application of the divisor function \$m\$ times. Perfect numbers are numbers whose divisor sum equals their double or \$\sigma(n) = 2n\$. For example, \$\sigma(6) = 12 = 2\times6\$ Superperfect numbers are numbers whose twic...
Gemtext is a very simple markup format used by the alternative web protocol Gemini. Write a Gemtext to HTML converter. From the Wiki: A line of text is a paragraph, to be wrapped by the client. It is is independent from the lines coming before or after it. A list item starts with an asterisk and a space. Again, the r...
I was asked by OEIS contributor Andrew Howroyd to post a Code Golf Challenge to extend OEIS sequence A049021. Would be super great to get a couple more terms for [...] A049021. Kind of thing [...] team golf would excel at. As I found out the hard way with the help of user202729, the definition of A049021 is... slippe...
For today's task, we have two programs, P and Q, both in the same language. Each of them receives a single-character input. If P receives character K, P says how many times K appeared in Q. (You can use any output format for P or Q; they need not be the same, the only requirement is that your format can represent any n...
Your friend has been caught sleeping in class again! As punishment, his computer science teacher has assigned him homework, knowing that he will not be able to solve it due to not having paid any attention. The assignment seems deceiving simple at first; all that is required is to output the string: John Doe Unfortunat...
Consider the sequence \$(a_n)\$ defined in the following way. \$a_0=0\$ For all \$n=1, 2, 3, \dots\$, define \$a_n\$ to be the smallest positive integer such that \$a_n-a_i\$ is not a square number, for any \$0\leq i<n\$ In other words, this is the lexicographically first sequence where no two terms differ by a squar...
Background This challenge is about the Game of Go. Here are some rules and terminology relevant to this challenge: Game of Go is a two-player game, played over a square board of size 19x19. One of the players plays Black, and the other plays White. The game is turn-based, and each player makes a single move each turn...
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 answer is 5449364 (or opti...
Given a non-empty sequence of non-negative integers, output any permutation of it in which no two adjacent elements have a sum that is divisible by 3. If it is impossible, either crash the program, return an empty sequence, or output nothing. The asymptotic time complexity must be linear in the size of the input sequen...
This challenge is related Challenge Your task is to write as many programs/snippets as you can, where each one outputs/prints/ returns an alphabet. The first program must output the letter A or a, the second one B or b and so on. You can not reuse any characters between the programs (Except Whitespace, it can be reused...
On Unix-like systems, the ls command lists files. GNU's version of ls also colors them according to their properties and the environment variable LS_COLORS. The main file property that ls bases its colors on is the file's mode. In this challenge, you will determine what keys from LS_COLORS ls should look for a given mo...
All integers \$n > 0\$ can be expressed in the form $$n = \prod_{\text{prime } p} p^e = 2^{e_2} 3^{e_3} 5^{e_5} 7^{e_7} \cdots$$ This form is also known as it's prime factorisation or prime decomposition, and each integer has a unique prime factorisation. As the bases are fixed, it is possible to reconstruct an integer...
NOTE: Some terminology used in this challenge is fake. For two integers n and k both greater than or equal to 2 with n > k, n is semidivisible by k if and only if n/k = r/10 for some integer r. However, n may not be divisible by k. Put more simply, the base 10 representation of n/k has exactly one digit after the decim...
Adapted from Tips for restricted source in Python Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the Powershell language. Now, We already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep wit...
Generate the following list of lists consisting of the unique last digits of the powers from 1 to 9 for the numbers [0..9] [[0], [1], [2, 4, 8, 6], [3, 9, 7, 1], [4, 6], [5], [6], [7, 9, 3, 1], [8, 4, 2, 6], [9, 1]] e.g. For the number 2 we have: \$2^1,2^2,2^3,2^4,2^5,... \to 2,4,8,16,32,64,128,... \to 2,4,8,6,4,8,.....
Challenge The main objective of the challenge is pretty simple, this is an answer chaining contest, where you have to serially print numbers from 1. That means User 1's answer will print 1, then User 2's answer will print 2 and so on. But there are some rules to make the contest tougher. Rules You can't use the charac...
For today's challenge you have to take an input, and if your source code is reversed, then the input should be printed doubled. Let's say your source code is ABC and its input is xyz. If I write CBA instead and run it, the output must be any of be xyzxyz or xyz xyz or xyz xyz For any numerical input you should not mu...
A huge storm is ravaging the world and as you and your family run away from it, you come across a gigantic shelter run by a girl. She tells you that "she sells sanctuary" and that different types of rooms are offered at different prices. A room may only house one person. The challenge Write a program which takes in two...
Background Roman numeral is a simple number system with the following properties: Each symbol in the system maps to a specific value. (e.g. I = 1, V = 5, X = 10, C = 100) The value of a Roman numeral can be evaluated as follows: First, find all occurrences of adjacent pairs of symbols where a strictly smaller-valued ...
Given a sequence of integers and an integer N, output the number of contiguous subsequences that contain at least N distinct integers. Each integer in the sequence is non-negative and will not be larger than the size of the sequence. For example, with the sequence 1,2,2,3 and N=2, there are 5 contiguous subsequences t...