# Puzzles

Jump to navigation
Jump to search

Problems to exhibit and strengthen your J muscles. In the Wiki spirit, the solutions are intended to be community efforts, and the solution pages slates on which to record your answers and observations.

- Find an interesting use of the monad
`*./`on a list of integers with length greater

than 2. Solution

- Find a tacit expression that computes
`f y`if`y`is greater than 1,

otherwise just return` y` . Solution

- Given a list of integers, set each item that is less than
`n1`to`n2`.

Can it be expressed without an explicit loop? Solution

- Find examples of "under". Solution
- What are some ways of computing the i-th Fibonacci number? Solution
- What are some ways of computing the sine of a number? Solution
- Puzzle of the year 2005: find phrases that generate each number
`i.100`. - Puzzle of the year 2006: find phrases that generate each number
`i.100`. - Puzzle of the year 2007: find phrases that generate each number
`i.100`. - Puzzle of the year 2008: find phrases that generate each number
`i.100`. - Puzzle of the year 2009: find phrases that generate each number
`i.100`. - Puzzle of the year 2010: find phrases that generate each number
`i.100`. - N Queens Problem: Place
`n`queens on an`(n,n)`chessboard so that none attacks another. Solution - Queens and Knights: Place an equal number of queens and knights on an
`(8,8)`chessboard so that none attacks another. What is the maximum number of pieces you can so place, and how many different ways can you do it? Solution - Find the sum of all the integers between
`1`and`10^11`that are both divisible by seven and, when the decimal digits are reversed, are still divisible by seven. Solution - Find a palindromic pangram. Solution
- Fill the zero gaps in a list using linear interpolation. Solution
- Find permutations such that adjacent numbers form a base-10 number not divisible by 3, 4, or 5. Solution
- Find a 9-digit number containing all the digits 1,2,...,9 such that divides for each . Solution
- Find
`k`-digit numbers`m`such that all`n-`digit prefixes of`m`are divisible by`n`. Solution - Find shortest and/or smartest phrase to build ASCII art I. Solution
- Find shortest and/or smartest phrase to build ASCII art II. Solution
- Another ASCII art puzzle: draw the complete binary tree of order
`n`. Solution - Instruct a human to sort a list, in the easiest possible way. Solution
- Create a non-trivial J quine, program script that prints itself. Solution
- APL Idioms puzzle from Vector 21.4. Solution
- Arrange a list of distinct positive integers so that no two numbers have their average between them. Solution
- How many ways can a unit fraction
`1%n`be expressed as a sum of unit fractions`1%x`and`1%y`? Solution - Given a list of words, find the top m most frequent words and the corresponding frequencies. Solution
- Find an expression for a sequence of exponents using subtraction as the only numeric operation. Solution
- Provide a sentence whose result is
`2147483647`. Constraints apply and are given on the solution page. Solution - Provide a sentence whose result is
`340282366920938463463374607431768211455`. Constraints apply and are given on the solution page. Solution - Provide a query which causes Google to return a J Dictionary page in the top 3 search results. Constraints apply and are given on the solution page. Solution
- Given a short J phrase, provide the equivalent common English idiom. Solution
- Generate the first
`2^n`gray codes. Solution - Given a primitive
`p`from the Vocabulary, define it in terms of other primitives. Solution - Find interesting equivalents of
`+/@i.`Solution - Under what conditions is it true that
`(x i. y) -: (~.x) i. y`? Solution - Find the sum of a non-empty numeric vector
`v`without using the character`+`. Solution - Determine all the times whose display on a 24-hour clock is prime Solution
- Compress the decimal representation of a natural number. Solutions
- Implement mergesort making a maximal use of J array-oriented features Solution