Linked Questions

41 votes
51 answers
7k views

Cops: Make a regex - Make a snake

This is the cop's thread. The robber's thread is here. Write a code that takes an input n and creates a n-by-n "snake matrix". A snake matrix is a matrix that ...
Stewie Griffin's user avatar
28 votes
17 answers
4k views

s-n-a-k-e-a-r-o-u-n-d--->

This ascii-art challenge is about walking around a string like a snake. s-n-a-k .---. e d <-' a n-u-o-r You will be given a string \$ S \$ of length \$ l \$ and ...
noodle man's user avatar
  • 5,497
27 votes
15 answers
7k views

Number Spiral Problem

A number spiral is an infinite grid whose upper-left square has number 1. Here are the first five layers of the spiral: Your task is to find out the number in row y and column x. Example: ...
Agile_Eagle's user avatar
29 votes
11 answers
3k views

Asterisk spiral

Given the spiral of size S and the step N, output the "square" S*S spiral having ...
nicael's user avatar
  • 4,813
22 votes
10 answers
2k views

Roll the Alphabet into a Spiral

Write a program or function that, when given n, will print a spiral n characters long made up of the Latin alphabet ...
Sherlock9's user avatar
  • 12.2k
33 votes
8 answers
1k views

Can square tree rings be generated from primes?

Apparently yes! In three easy steps. Step 1 Let f(n) denote the prime-counting function (number of primes less than or equal to n). Define the integer sequence s(n) as follows. For each positive ...
Luis Mendo's user avatar
  • 104k
31 votes
7 answers
2k views

pssssssssssssst

Introduction This is one is pretty straightforward. We will be drawing a snake in ascii. This was inspired by that old snake game where you have to collect the fruit and you continuously grow. ...
jacksonecac's user avatar
  • 2,624
24 votes
9 answers
995 views

Spiral neighbourhoods

If we take the natural numbers and roll them up counter clock-wise into a spiral we end up with the following infinite spiral: ...
ბიმო's user avatar
  • 16.7k
6 votes
15 answers
1k views

Alphabet Spiral

You are to write a program or function that outputs this exact text: OPQRSTU NQPONMV MREDCLW LSFABKX KTGHIJY JUVWXYZA IHGFEDCB May also be lowercase and trailing ...
DanTheMan's user avatar
  • 4,065
15 votes
9 answers
683 views

Roll the carpet

This question is inspired by Kevin Cruijssen's question. Now that the carpet is laid out, we want to roll it. Your task is to write a program that takes a string and returns a spiral made from this ...
Bromind's user avatar
  • 289
11 votes
7 answers
800 views

Determine the position of a non-negative number in the infinite spiral

Definition The infinite spiral used in this question has 0 on the position (0,0), and continues like this: ...
Leaky Nun's user avatar
  • 49.6k
13 votes
11 answers
795 views

Square-unspiral the string!

Given a string, first square it as follows: First, write the string. abcde Next, write the string rotated one left. ...
Oliver Ni's user avatar
  • 10.6k
6 votes
5 answers
443 views

Return Spiral Indexes!

Spirals are cool , so are numbers, and number spirals are even cooler. But what if I want a specific number, in a specific place using xy coordinates... Challenge Using an infinite spiral moving ...
KrystosTheOverlord's user avatar
8 votes
4 answers
216 views

Flattened Spiral Permutation Index

Context Consider square matrices with n columns and rows containing the first n^2 (i.e. n ...
dylnan's user avatar
  • 5,334
4 votes
4 answers
143 views

Given a grid, starting at the center and spiraling out, and an Position what is the ID?

Related: Determine the position of a non-negative number in the infinite spiral Wind me a number snake! Challenge: Given a grid, with an ID starting at the center and spiraling out, what is the ID ...
Justin808's user avatar
  • 151

15 30 50 per page