instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
GHC command line errors can be horrible, lets make them as bad as possible. To disincentivize very long programs use the following formula to calculate your "score". (# of bytes of GHC output) / 2^(8 + # of bytes of code) Template Haskell is banned as there is probably a TH configuration where you can replicate an err...
stackexchange_codegolf
First, some definitions. A Hadamard matrix is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. The Hadamard conjecture proposes that a Hadamard matrix of order 4k exists for every positive integer k. A circulant matrix is a special kind of matrix where each row vector is rotate...
stackexchange_codegolf
Write a function to produce, for a non-negative integer, a string containing a sum of terms according to the following: 3 -> "3" 805 -> "800 + 5" 700390 -> "700000 + 300 + 90" 0 -> "0" 13 -> "10 + 3" 200 -> "200" Any input other than a non-negative integer can be ignored. Zero terms must be skipped unless the inp...
stackexchange_codegolf
Most computers store integers in binary, but output them in decimal. However, decimal is just one representation, we just happen to find it convenient. This challenge is to write some code to output an integer value in shortlex decimal. What's that? http://en.wikipedia.org/wiki/Shortlex_order Shortlex takes the length ...
stackexchange_codegolf
I'm trying to solve a CSS challenge. It contains a rotated leaf shape (looks like an eye). Score for the challenge depends on amount of characters of the code. Here's my way to make a leaf shape: div { width: 200px; height: 200px; border-radius: 99% 0; rotate: 45deg; background: #d9d9d9; } <div></div> He...
stackexchange_codegolf
Introduction The Sierpinski Arrowhead Curve is a curve that's limit is Sierpinski's Triangle. It first starts like this: _ / \ Then, each line is replaced with a rotated version of the first one: _ / \ \ / _/ \_ Next: _ / \ \ / _/ \_ / \ \_ _/ _ \ / _ / \_/ \_/ \ Your task Given a ...
stackexchange_codegolf
Can you decrypt me? Cops Cops, post obfuscated code that hides a number \$n\$ (n must not be greater than the program length) inside its code. If \$n\$ chars are changed (no additions or deletions), the program outputs exactly one \$n\$ (any amount of whitespace before or after is allowed.) Otherwise, it outputs someth...
stackexchange_codegolf
Create a program which when run displays the text below: )-*-*-*^_^*-*-*-( | Welcome User! | )-*-*-*^_^*-*-*-( Use any functions or language to answer this, have fun. Shortest code wins
stackexchange_codegolf
What is the best BrainFuck code (in terms of code size) to print 'A' 1000 times ? My approach is: set 'A' to p[0] set 255 to p[1] to display 255 'A', 3 times set 235 to p[1] to display 235 'A' This is not effective but I cannot find a way to use tow counters simultaneously like a multiplication Is there a better appr...
stackexchange_codegolf
I'm honestly surprised that this hasn't been done already. If you can find an existing thread, by all means mark this as a duplicate or let me know. Input Your input is in the form of any positive integer greater than or equal to 1. Output You must output the sum of all integers between and including 1 and the number i...
stackexchange_codegolf
Write a program that accepts a single lowercase word as input and outputs the number of pairs of letters that have the same number of letters between them in the word as in the alphabet. For example, in the word 'nature', we have 4 pairs: nr: since there are three letters between them inside the word (a, t, u) and thr...
stackexchange_codegolf
Write a program which will eventually, given enough time, print all possible permutations of ASCII characters (both printable and non-printable) less than or equal to its length, except itself. The text of the program must not appear anywhere in its output. For example, if your program is abc, then part of your output ...
stackexchange_codegolf
Note: This challenge has been moved to Polyglot the (non constant) OEIS! to avoid closure. Introduction We all know and love the on-line encyclopedia of integer sequences (OEIS). So what if we made an off-line version? Well, that would be kinda too easy, wouldn't it and how would you select a sequence with our standa...
stackexchange_codegolf
Background A few months ago, the adventure of your life was just about to start. Now, in this precise moment (yeah, now), after months of suffering and hard work, you and a group of friends are standing on the top of the world. Yes, you are right, you are on the summit of Sagarmāthā. However, things aren't going as wel...
stackexchange_codegolf
Every now and again, I'll encounter a large string of alphabetical text encoded as numbers from 1-26. Before I knew that I could just google a translator online, I had to personally, painstakingly copy and paste the entirety of the encoded text into a text document and translate it myself. Thankfully, I did know about ...
stackexchange_codegolf
Introduction Ah, INTERCAL... As much as I'd like encourage everyone to Try it Online, text output is just painful. According to the docs it uses the "Turing Text Model". While an... interesting concept, using it is about as much fun as shooting yourself in the foot. And what do we do with a task like this? Automate it....
stackexchange_codegolf
Imagine a grid where the origin square \$(0,0)\$ is at the top left of the screen, and positive \$x\$ is rightwards whereas positive \$y\$ is downwards. Coloured squares are at various positions on the grid. In a magical void separate from the grid are multiple snake-like strips of squares, each of a fixed length and a...
stackexchange_codegolf
The JavaScript compressor RegPack uses a very simple string compression algorithm. Given a piece of code, it will make a list of characters that aren't used in that code and use them to delimit repeated strings that are inserted back into the string. To show how strings are compressed, it's necessary to show how the de...
stackexchange_codegolf
Fastest code is a scoring method on this site where the goal is to write code that is as fast as possible. From the tag wiki: The winner of a fastest-code challenge is determined by the runtime performance of the submissions. For fairness, all submissions should be benchmarked on the same machine, which usually means ...
stackexchange_codegolf
The challenge is to write the most elaborate code, embedded in ASCII art that reads and prints "DFTBA". For example, the following reads DFTBA: oooooooooo. oooooooooooo ooooooooooooo oooooooooo. .o. `888' `Y8b `888' `8 8' 888 `8 `888' `Y8b .888. 888 888 888 8...
stackexchange_codegolf
4, 32, 317, 3163, 31623, 316228, 3162278, 31622777, 316227767, 3162277661, 31622776602, 316227766017, 3162277660169, 31622776601684, 316227766016838, 3162277660168380, 31622776601683794, 316227766016837934, 3162277660168379332, 31622776601683793320, 316227766016837933200, 3162277660168379331999, 31622776601683793319989...
stackexchange_codegolf
Gravity Guy is a game where the only user input is a single key that flips the direction of gravity. Given an ASCII art level, determine if it is possible for Gravity Guy to reach the end. Rules The initial direction of gravity is down. The first column of the input will always contain only one #, which Gravity Guy s...
stackexchange_codegolf
I have the code below working. But there must be a better way. file <- "http://s3.amazonaws.com/assets.datacamp.com/production/course_1127/datasets/tmp_file.csv" x <- read.csv(file = file) ts <- xts(x = x, order.by = as.Date(rownames(x), "%m/%d/%Y")) cd=coredata(ts) for (j in 1:length(names(ts))) cd[,j]<-cd[,j]/cd[1,...
stackexchange_codegolf
The sequence discussed in this challenge is a variant of the Descending Dungeons sequence family. Specifically, the sequence generation rules: (A_b = A's base 10 representation read as a base b number, A = A_10) A(0) = 10 A(n) = 10_(11_(12_(...(n+9)_(n+10)))) Your goal is to make a program which accepts a nonnegative ...
stackexchange_codegolf
Tab completion is a useful feature that auto-completes partially written commands. You're going to be implementing it. For example, if the available commands were ['apply','apple','apple pie','eat'], then a would complete to appl, as all of the commands that start with a also start with appl. Input/Output You need to...
stackexchange_codegolf
Challenge Inspired by this video. As you may know, a palindrome is a word that is spelled the same forward as it is backward. The word "PULP" is not a palindrome, but when translated into Morse Code (with the spacing between letters removed), "PULP" becomes ".--...-.-...--." which is a palindrome. Your task is to write...
stackexchange_codegolf
Given a natural number \$n\$, return the \$n\$-th Leyland number. Leyland Number Leyland numbers are positive integers \$k\$ of the form $$k = x^y + y^x$$ Where \$x\$ and \$y\$ are integers strictly greater than 1. They are enumerated in ascending order. EDIT: @DigitalTrauma suggested I include following "definition": ...
stackexchange_codegolf
Recently I read the novel "The Solitude of Prime Numbers" where the main characters are somewhat compared to twin prime numbers ("always together, but never touching"). A twin prime is a prime number that is either \$\require{cancel}2\$ less or \$2\$ more than another prime number —for example, the twin prime pair \$(...
stackexchange_codegolf
You are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into sections that are enclosed in a "group" created by [...] and those that are not. e.g. "absbn[mesl]meslo[eyyis]me" -> "absbn" "mesl" "meslo" "eyyis" "me" Super simple right? Well hold your horses. ...
stackexchange_codegolf
Given a string input, your task is to write a program that prints a truthy value to STDOUT or equivalent if the input contains "2016" anywhere in it without using any built-in contains, match, replace, split or other functions that use patterns or regexes. A truthy value also must be printed if the input contains "2016...
stackexchange_codegolf
I'm one of the authors of Gimli. We already have a 2-tweet (280 chars) version in C but I would like to see how small it can get. Gimli (paper,website) is a high speed with high security level cryptographic permutation design that will be presented at the Conference on Cryptographic Hardware and Embedded Systems (CHES)...
stackexchange_codegolf
Here is the challenge as proposed by @trichoplax thanks to him for consolidating my post and standarizing it to PPCG common-rules. A galaxy is a group of numbers where each one is mapped to another via a precise function f either a symbolic one or mathematical, a structure of numbers sharing some common points with t...
stackexchange_codegolf
Background From Wikipedia: An Egyptian fraction is the sum of distinct unit fractions. That is, each fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, and all the denominators differ from each other. The value of an expression of this type is a positive rational number ...
stackexchange_codegolf
Challenge Given a time and a timezone as input, output the time in that timezone. Time The time will be given in 24 hour format like so: hh:mm Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so: 06:09 All the times given are at UT...
stackexchange_codegolf
Given a WxH grid, how many possible mazes are there? Things you know about the maze: The grid is exactly H squares high and W squares wide. There are three types of squares: Start, Finish, and Empty. Your maze must contain exactly 1 Start and 1 Finish, and all remaining squares are Empty. There are walls surrounding ...
stackexchange_codegolf
Challenge The goal of this challenge is to make a function that takes two paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy (but a single copy of the part of overlapped lines should be kept to avoid information loss). Each input paragraph is with the follows spe...
stackexchange_codegolf
Given a date, output the X and Y position of the current day of the date on a digital calendar. The digital calendar is sort of the calendar that gets shown when you click on your computers clock (at least on windows), and it looks something like this: If we assume that the given date is 25.09.2017, the result would b...
stackexchange_codegolf
Oh no! I'm trapped in a big forest (Okay, not really, but just assume it) and I don't know where I am! Thankfully, I brought my laptop. But when I searched 'Maps', It said 'No results', and I'm asking this as a last resort. Please make a program which outputs my location's longitude and latitude in any two number forma...
stackexchange_codegolf
Write the shortest function to generate the American Soundex code for a surname only containing the uppercase letters A-Z. Your function must produce output consistent with all the linked page's examples (given below), although it need not and should not remove prefixes. Hyphens in the output are optional. Have fun! No...
stackexchange_codegolf
Sometimes when you're lying in bed and reading a message, your phone screen will pop into landscape mode right in the middle of a sentence. Only being able to read left to right, you find yourself incapacitated, unable to process the text in front of you. To ensure that this won't happen again, you decide to make every...
stackexchange_codegolf
I like card game challenges so I made this one for the Italian card game Scopa. My family has been playing this game since time immemorial. It has a very interesting scoring system that should be fun to golf. I will post an answer in R to get the fun started, that I am sure people will improve upon. The challenge: figu...
stackexchange_codegolf
Ex :- Input: n = 12, k = 5 Output: ans = 2 Sorted list S: ["1", "10", "11", "12", "2", "3", "4", "5", ...., "9"] ans = 2
stackexchange_codegolf
The task is to find the smallest paper size on which it is possible to print a picture of the dimensions given in milimetres. The image will be printed without margins. Input: Two integers (bigger than zero) and a letter a, b, or c, for example: 290 200 A Output: Paper size, for example: A4 Another examples: 218,297...
stackexchange_codegolf
Lagrange's four square theorem tells us any natural number can be represented as the sum of four square numbers. Your task is to write a program that does this. Input: A natural number (below 1 billion) Output: Four numbers whose squares sum to that number (order doesn't matter) Note: You don't have to do a brute force...
stackexchange_codegolf
I have come across an article where students used network traffic to draw their university on the country's IPv6 graph. [image] Your goal is simple to tell, but hard to implement. Draw the text MAIL (as it is one of the few words that can be read on a 1D graph) on the CPU graph. It should look something like this: E...
stackexchange_codegolf
An integer \$x\in[0,2^{32}-1]\$ divided by an integer \$d\in{[1,2^{31}]}\$ will produce an integral quotient \$q\$ and a remainder \$r\$, so that \$x=d\times q+r\$. Any \$q\$, in fact, can be calculated by the following formula. $$y=\left\lfloor\frac{mx}{2^{32}}\right\rfloor\\q=\left\lfloor\frac{y+f\lfloor(x-y)/2\rfloo...
stackexchange_codegolf
Saw this in a PHP challenge. The objective is to make a chessboard with 64 squares (8*8) with the minimum amount of code. Simple enough, I made mine in PHP in 356 bytes (not impressive, I know) and I would like to see some other aproaches. This can be made in a language of your choice, as long as you keep it vanilla, s...
stackexchange_codegolf
I am not sure if this is possible. I have tried it and couldn't make it work at all, but I am being hopeful. If this is not possible please flag this question and I will promptly delete it. Conditions are simple, Write code that will output same amount of character in the same shape as the code. For example (A very stu...
stackexchange_codegolf
Shuffling a deck of cards is hard for kids, so they must figure out ways to get a reasonable well shuffled deck as simply as possible. One way to do this that gives reasonably good results is: Take the top card out and insert it a random place in the deck Take the bottom card out and insert it in a random place in the...
stackexchange_codegolf
This is a two-player card game which resembles a vastly simplified game of Texas Hold'em, combined with RPS (rock-paper-scissors) and the most basic mechanic of commercial turn-based card games. The deck A single full deck consists of 30 unique cards, where each card has one symbol out of RPS and one number between 0 a...
stackexchange_codegolf
A man has two devices. A time machine - He can control this machine by thinking. It allows him to travel from any point in time to another point in time in the past or future (or even the present point in time) in no time at all. Note that if he travels to the past from B to A, then all normal events (time machines, a...
stackexchange_codegolf
For the given string s, generate generate a table like below. Input:abcd Output: abcd bbcd cccd dddd Input:Hello, world! Output: Hello, world! eello, world! llllo, world! llllo, world! ooooo, world! ,,,,,, world! world! wwwwwwwworld! ooooooooorld! rrrrrrrrrrld! llllllllllld! dddddddddddd! !!!!!!!!!!!!! Trailin...
stackexchange_codegolf
WARNING: This challenge may need 128 bit floats.1 The task is to perform numerical integration. Consider the following three functions. \$ f(x) = cx^{c - 1}e^{-x^c} \$ \$ g_1(x) = 0.5e^{-x} \$ \$ g_2(x) = 5 e^{-10 x} \$ We will have that \$c \geq 0.2\$. Your code should be correct for any value between 0.2 and 1.0. ...
stackexchange_codegolf
The VIC cipher is one of the most complicated pencil and paper ciphers ever devised. Used in the 1950s by Soviet spy Reino Häyhänen, codenamed "VICTOR", its main principle is security through obfuscation; a lot of obfuscation. Your task is to write a program or function that will take a message and encode it using the ...
stackexchange_codegolf
Given Color codes in CMYK, convert it to RGB value. Input: string of 4 integers(ranging from 0-100) separated by space 86 86 0 43 28 14 0 6 0 41 73 4 Output: #141592 #ABCDEF #F49043 Shortest code wins! HINT: For converting CMYK to RGB you may use formula such as: Red = 255 x (1 - Cyan/100) x (1 - Black/100) ...
stackexchange_codegolf
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...
stackexchange_codegolf
Given an integer p > 1, find the smallest integer q > p such that the list of exponents in the prime factorization of q is the same of that of p, no matter the order or the value of the prime factors. Examples The prime factorization of p = 20 is 22 x 51. The smallest integer greater than p with identical exponents in ...
stackexchange_codegolf
This challenge has officially ended. Further submissions will not be competitive (but are still welcome!). View the scores here In this challenge, submissions ("bots") should be Javascript functions which try to win as many races as possible. In each race, bots will have a limited amount of energy which should be use...
stackexchange_codegolf
In this variant of the Four fours puzzle your should use up to x x's (and no other number) and a defined set of operations to reach every number from 0 to 100. If x = 4 then you can use up to four 4s and this question becomes the classic four fours puzzle (except you can use up to four 4s rather than having to use exac...
stackexchange_codegolf
Challenge Given two positive integers \$1 \le m \le 12\$ and \$1\le d \le 31\$, representing a month and days into the month, output the amount of days that have passed since January 1st, on a non-leap year. You can assume that the number of days passed will always be constrained by the number of days in the month (so ...
stackexchange_codegolf
You are given 100 arrays/sets of 5-8 numbers between 1-20. If you combine all the arrays you will always get at least one of each number (1-20), so don't worry about an "unsolvable" case. The goal is to find the combination of arrays that minimizes duplicate numbers while still getting one of each number from 1-20. Her...
stackexchange_codegolf
Most people are familiar with the trope about counting sheep to fall asleep. There's a herd of sheep, some of them jumping over a fence, and you count the sheep as they jump. Supposedly, this helps quiet your mind and gets you into a sleep-like state so that you'll fall asleep. Here's an ASCII sheep facing to the right...
stackexchange_codegolf
Challenge Premise Bob is a novice pianist who can only play sequences of single notes. In addition, he does quite an interesting thing: for every note after the first, if it's higher than the previous note was, he uses the finger directly to the right of the previous finger used; if lower, to the left; if the same pitc...
stackexchange_codegolf
Weather forecasting: Wrong too often to rely on, right too often to ignore. Given a high and low temperature and one of four weather conditions per day, output an ASCII-art graphical five day weather forecast. The structure of the four graphical indicators are shown below. \ / -O- Sunny / \ \ / -O(==) ...
stackexchange_codegolf
There are 5 different "special characters": % & # $ ! These special characters are in a string with numbers. Like so: "5 ! 60%2$5.3" (valid). You must determine the validity of the string and there are certain rules in order to determine validity of the string. Rules: These special characters can exist in a string...
stackexchange_codegolf
For more MtG-goodness: Magic: The Gathering Combat with Abilities Premise: In Magic: the Gathering, you cast spells by paying their mana cost by tapping lands for the required amount. These lands can produce one of the five colors which are: White (W) Blue (U) Black (B) Red (R) Green (G) The cost is made up of two...
stackexchange_codegolf
Given the name of an HTTP status code, such as OK or Continue, output or return the corresponding number. Your code is limited to 200 bytes, and the winner is the answer that correctly finds the number for the most status codes. For this challenge, the status codes your program should handle are: 100 Continue 101 Switc...
stackexchange_codegolf
Given 4 points on the 2D planes A, B, C, D, calculate the area of the intersection region of the triangles OAB and OCD, where O is the center of the plane, having coordinate (0, 0). Algorithms that runs in constant time complexity (in terms of arithmetic operations) are encouraged, but not forced. Rules Each point is ...
stackexchange_codegolf
In mountaineering terminology, a "14er" is any mountain with an elevation of 14 000 feet or more. However, there is another distinction. For a peak to count as a 14er, it must also have a "geographic prominence" of 300 or more feet. This means that to move from one 14er to another, you must first descend at least 300 f...
stackexchange_codegolf
A piggy bank is a container used to collect coins in. For this challenge use the four US coins: quarter, dime, nickel, and penny. Challenge Your challenge is to create an electronic piggy bank. Write a program (or function) that when run (or called), outputs (or returns) the count of each coin you have, as well as the ...
stackexchange_codegolf
Introduction In the error outputs of some languages such as Java, a pointer is shown to give the programmer an idea of exactly where the error went wrong. Take this example on Ideone: Main.java:12: error: ';' expected Invalid Java! ^ Notice the caret shows where the invalid code is? Challenge Your...
stackexchange_codegolf
Last challenge (Pixel-art, episode 1: display Super Mario) was just a training... (and you completed it in amazing ways, thanks!) This time, you have to work a little bit more. You have to display all the first overworld map of Super Mario bros on NES, without enemies, and without Mario. Your program or function must d...
stackexchange_codegolf
Can you recover a sequence of letters from a sequence of dots and dashes? In Morse code, x is represented by -..-, but without the help of spaces, -..---.-... could represent xmas, or dole, or teettteteee, etc. I took the lyrics from "Rudolph, the Red-Nosed Reindeer" to make the following sequence of letters: youknowda...
stackexchange_codegolf
Information Given a non-negative odd integer (let's call it \$n\$), find the number of all possible paths which covers all squares and get from the start to end on a grid. The grid is of size \$n\$×\$n\$. The start of the path is the top left corner and the end is the bottom right corner. You have to count the number ...
stackexchange_codegolf
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 ...
stackexchange_codegolf
The purpose of this challenge is to graphically depict a walk on the plane, where the direction of each step \$k\$ is determined by the primality of \$k\$ and the parity of its binary expansion. Specifically, Initial direction is fixed, say North. All steps have the same length. The direction of step \$k\$ can be Nort...
stackexchange_codegolf
* and don't have a word processor with top-left align support :D Take several lines of input, with at least four unique characters of your choice including newline and space. The input can also be taken as a space-padded matrix of characters. Squash it upwards, then squash it left. Output this, with any amount of trail...
stackexchange_codegolf
disclaimer: the Mean mean is made up by me Define the arithmetic mean of \$n\$ numbers as $$M_1(x_1,...,x_n)=\frac{x_1+x_2+...+x_n}{n}$$ Define the geometric mean of \$n\$ numbers as $$M_0(x_1,...,x_n)=\root{n}\of{x_1x_2...x_n}$$ Define the harmonic mean of \$n\$ numbers as $$M_{-1}(x_1,...,x_n)=\frac{n}{\frac{1}{x_2} ...
stackexchange_codegolf
I know it's 1.5 weeks after Christmas but trying to print an isosceles triangle in a monospaced font makes it look weird. Challenge Print the alphabet from A to Z so that it forms a filled triangle in the output. For each line in the output, starting from "A", add the next letter. No inputs, only outputs. Pad the leadi...
stackexchange_codegolf
The objective Given a Russian text, encrypt it with Caesar cipher with key 16. The basic Cyrillic alphabets The basic Cyrillic alphabets are: (U+0410 – U+042F) АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ By the Caesar cipher, they are mapped to: РСТУФХЦЧШЩЪЫЬЭЮЯАБВГДЕЖЗИЙКЛМНОП The small letters (U+0430 – U+044F) are also mappe...
stackexchange_codegolf
The purpose of this challenge is to graphically depict a walk on the plane, where the direction of each step \$k\$ is determined by the primality of \$k\$ and the parity of its binary expansion. Specifically, Initial direction is fixed, say North. All steps have the same length. The direction of step \$k\$ can be Nort...
stackexchange_codegolf
To quote http://brainfuck.org/utm.b: A tag-system transforms strings over an alphabet A = {a[1], a[2], ... a[n], a[n+1]} as follows: a positive integer m is chosen, and so is a function P that maps each a[i] for 1<=i<=n to a string P(a[i]) over the alphabet A. Now: if the string being transformed has fewer than m ele...
stackexchange_codegolf
The scenario Lately you have been noticing some strange behavior with your favorite text editor. At first it seemed that it was ignoring random characters in your code when writing to disk. After a while you noticed a pattern; characters with odd ASCII values were being ignored. Under further inspection you discovered ...
stackexchange_codegolf
I tried this contest: https://www.hackerrank.com/challenges/secret-language Well, the score in this contest said I made 30 out of 30 points. As the score is calculated with the formula 30*(1000-#chars)/1000 this is impossible. Here is my code: import sys,string as s b='anbycoduepfxgqhvirjzkslwmt' a=s.letters b+=b.upper...
stackexchange_codegolf
Unsurprisingly, fibonacci primes are primes that are also Fibonacci numbers. There are currently 34 known Fibonacci primes and an additional 15 probable Fibonacci primes. For the purpose of this challenge, the Fibonacci numbers are the sequence \$F_n\$ defined as \$F_1 = 1\$, \$F_2 = 1\$, and \$F_n = F_{n-1} + F_{n-2}\...
stackexchange_codegolf
Did you notice, that this is a palindrome? Input Non-negative integer number or string representing it Output 4 possible outputs, representing two properties of number: is it palindrome tricky #2 Tricky #2 property If number is not palindrome, this property answers the question "Do the first and the last digits have...
stackexchange_codegolf
Sandbox The major scale (or Ionian scale) is one of the most commonly used musical scales, especially in Western music. It is one of the diatonic scales. Like many musical scales, it is made up of seven notes: the eighth duplicates the first at double its frequency so that it is called a higher octave of the same note....
stackexchange_codegolf
(l, r) defines a line whose left end is at l and the right end is at r, on a 1-dimensional space. Given 2 lines b = (0, bz) and f = (i, i + fz), v = (l, r) is the overlapping part of these lines. When b and f do not overlap (when v cannot have a positive length), v = (0, 0). (input) -> (output) bz, fz, i -> l, r The...
stackexchange_codegolf
The string tut-tutut-tut-tuttut-tut can be constructed with overlapping or concatenated instances of the word tut-tut: tut-tutut-tut-tuttut-tut tut-tut tut-tut tut-tut tut-tut The string tut-tututut-tutut-tut cannot: tut-tututut-tutut-tut tut-tut^ |tut-tut | tut-tut ...
stackexchange_codegolf
Write a program or function which, given a positive integer as input, outputs the representation of that integer in Maya numerals. Maya numerals Maya numerals is a vigesimal system (base 20) using only 3 symbols : < > for Zero (The correct symbol is some sort of shell that can't easily be represented using ASCII). . ...
stackexchange_codegolf
A little while back, data was frequently stored on punched card. A typical card would have 80 columns of 12 possible 'punch' positions. A plethora of encodings was used, each for their own specific purpose. These days we like to think of a byte as 8 bits. In this challenge, you're tasked to convert an 8-bit byte to a 1...
stackexchange_codegolf
Let's consider the following sequence: $$9,8,7,6,5,4,3,2,1,0,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71...$$ This is the sequence of \$9\$'s complement of a number: that is, \$ a(x) = 10^d - 1 - x \$ where \$ d \$ is the number of digits in \$ x \$. (A061601 in the OEIS).Your task is to add the first \$n\...
stackexchange_codegolf
Introduction Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. The first challenge in this series is to output a(n) for a given n as input, where a(n) is A064413, also known as the EK...
stackexchange_codegolf
Choose a challenge from the Cops thread, determine the third hidden message, and describe how the system works. Keep in mind limitations and possibilities available to Cops: You are not expected to guess any cryptographic secrets or additional information required to extract the hidden messages, as they should have al...
stackexchange_codegolf
Challenge In this challenge, you have to fill an \$M\$ x \$N\$ rectangle grid with the most \$A\$ x \$B\$ rectangle pieces possible. Requirements: The sizes of the \$M\$ x \$N\$ rectangle grid is always bigger than the sizes of the \$A\$ x \$B\$ rectangle pieces. In other words, \$min(M, N) ≥ max(A, B)\$ You can freel...
stackexchange_codegolf
Challenge Given an integer, n, as input where 36 >= n >= 2, output how many Lynch-Bell numbers there are in base n. The output must be in base 10. Lynch-Bell Numbers A number is a Lynch-Bell numbers if: All of its digits are unique (no repetition of digits) The number is divisible by each of its digits It doesn't cont...
stackexchange_codegolf
Let's for once do something useful. Given the text from a Try It Online codegolf submission, produce the equivalent Chat Mini Challenge submission, which is of the form Language, N bytes: [`code`](URL) or (if submission is a single byte – TIO will add a trailing s on the first line only if needed) Language, 1 byte: [`...
stackexchange_codegolf
"Talk" is a baroquified accumulator-based language that is created in response to Dennis's quote on talk.tryitonline.net. Waiting for someone to create an esolang called talk. . The "Talk" language has 4 commands: 00 If the accumulator is 0, set the accumulator to 0. 01 If the accumulator is 0, set the accumulator t...
stackexchange_codegolf
You have to make something that takes in one input from a default I/O method (as an integer), and prints out the sum of all the permutations of that number (not necessarily unique) For example: 10 would return 11 because 10 can have 2 permutations (10 and 01), and the sum of those two numbers would be 11 202 would have...
stackexchange_codegolf
Given a non-empty list L of integers greater than 1, we define d(L) as the smallest positive integer such that n + d(L) is composite for each n in L. We define the sequence an as: a0 = 2 ai+1 is the smallest integer greater than ai such that d(a0, ..., ai, ai+1) > d(a0, ..., ai) Your task You may either: Take an in...
stackexchange_codegolf