# Sliding Puzzle

2016-04-16, post № 117

games, programming, Pygame, Python, #apple, #piece, #tile, #tile game, #tile sliding, #tiles

This is my version of a sliding puzzle.
A sliding puzzle is based on a number of tiles (15 in this case) which are scrambled.
The objective of the game then is to slide the tiles around and get back to the original image.
As an image I took a photo of an apple in front of a black background.For more information on sliding puzzles, check this Wikipedia entry.

## Controls

• ‘F1’ takes a screenshot,
• ‘F2’ starts and stops scrambling the image,
• ‘F3’ solves the puzzle,
• Mouse clicks slide tiles.
Source code: sliding-puzzle.py

# Factorization

2016-04-09, post № 116

mathematics, programming, Python, #factor, #factorize, #factors, #prime, #prime factorization, #unique factors

Playing around with prime numbers, I created this simple factorization program.
The interesting thing about prime factors is that they are unique. There can only be one way to multiply prime numbers to get 𝑛 where $n\in\mathbb{N}$ and $n\geq 2$ (excluding the commutative property).For example, $2\cdot 3\cdot 7=42$ and that is the only way to multiply prime numbers to get to 𝟦𝟤.

Source code: factorization.py

# Jappy Jird

2016-04-02, post № 115

games, programming, Pygame, Python, #bird, #clone, #flappy, #flappy bird, #game clone, #pixel, #pixel game, #pixel-themed, #pixelated

This game is a clone of the famous international hit Flappy Bird.
You control the little pixel-bird, while it flaps through three different scenes and tries to avoid deadly pipes. Your score is measured by how many pipes you can pass.

## Controls

• ‘Escape’ pauses and resumes the game,
• ‘F1’ takes a screenshot,
• Up arrow key makes the bird flap.
Source code: jappy-jird.py

# Prime-Generating Formula

2016-04-01, post № 114

mathematics, #generating, #prime formula, #primes

(April Fools’!) I came up with this interesting prime-generating formula. It uses the constant 𝜉 and generates the primes in order!

The constant’s approximation.

The formula $p_n$ calculates the 𝑛-th prime.

The first few values for $p_n$ when starting with 𝑛 = 𝟢 are as follows.

# First Anniversary

2016-03-28, post № 113

art, #1 year, #1st, #animated, #animated gif, #birthday, #celebrate, #gif, #one year

J-Blog celebrates its first anniversary!

# Happy Easter II

2016-03-27, post № 112

art, #animated, #animated gif, #bunny, #celebrating, #celebrating easter, #chicken, #egg, #gif, #present, #rabbit

Little pixel guy wishes you a happy easter!

# Pascal’s Triangle

2016-03-26, post № 111

mathematics, programming, Pygame, Python, #crown, #generate, #sequence

Pascal’s triangle is an interesting mathematical sequence. It is often written as a triangle, starting with $\{1\}$, then $\{1,1\}$. To generate the next row, you add the two numbers above to form another one. So the next row in the sequence is $\{1,2,1\}$ then $\{1,3,3,1\}$, $\{1,4,6,4,1\}$ and so on (sequence A007318 in OEIS).

One interesting property of Pascal’s triangle is the generation of binomials.
To calculate $(a+b)^4$, you can look at the 𝟦-th row (listed above and when starting to count at 𝟢) and determine

This program generates Pascal’s sequence in a rather unusual shape, looking a bit like a crown.

## Controls

• ‘Space’ takes a screenshot.
Source code: pascals-triangle.py

[1]

# Palindromic Primes

2016-03-23, post № 110

mathematics, programming, Python, #generating, #numbers, #palindrome, #palindromes, #palindromic numbers, #prime numbers, #prime palindromes, #symmetric numbers, #symmetry

TheOnlinePhotographer has published a post to celebrate 𝟣𝟩𝟣𝟩𝟣𝟩 comments and was amused by the number’s symmetry.
A great comment by Lynn pointed out that this number is indeed an interesting number but not symmetrical.
Symmetrical numbers or words — also called palindromes — are defined as being the same read forwards or backwards. Examples for palindromic words are “radar”, “noon” or “level”. Palindromic numbers are 𝟥, 𝟦𝟢𝟦 or 𝟣𝟩𝟤𝟤𝟩𝟣.

Lynn then went further and checked if 𝟣𝟩𝟣𝟩𝟣𝟩 is at least a prime [1]. The number sadly has five distinct prime factors ($171717=3\cdot 7\cdot 13\cdot 17\cdot 37$).

So Lynn wondered what the next palindromic prime would be.
To answer this question, I wrote this little Python program to check for palindromic primes. The first 𝟣𝟤𝟢 palindromic primes are shown below.
Based on this list, the smallest palindromic prime larger than 𝟣𝟩𝟣𝟩𝟣𝟩 is 𝟣𝟢𝟢𝟥𝟢𝟢𝟣.

      3,       5,       7,      11,     101,     131,     151,     181,
191,     313,     353,     373,     383,     727,     757,     787,
797,     919,     929,   10301,   10501,   10601,   11311,   11411,
12421,   12721,   12821,   13331,   13831,   13931,   14341,   14741,
15451,   15551,   16061,   16361,   16561,   16661,   17471,   17971,
18181,   18481,   19391,   19891,   19991,   30103,   30203,   30403,
30703,   30803,   31013,   31513,   32323,   32423,   33533,   34543,
34843,   35053,   35153,   35353,   35753,   36263,   36563,   37273,
37573,   38083,   38183,   38783,   39293,   70207,   70507,   70607,
71317,   71917,   72227,   72727,   73037,   73237,   73637,   74047,
74747,   75557,   76367,   76667,   77377,   77477,   77977,   78487,
78787,   78887,   79397,   79697,   79997,   90709,   91019,   93139,
93239,   93739,   94049,   94349,   94649,   94849,   94949,   95959,
96269,   96469,   96769,   97379,   97579,   97879,   98389,   98689,
1003001, 1008001, 1022201, 1028201, 1035301, 1043401, 1055501, 1062601, ...

Thus it takes $1003001-171717=831284$ more comments to reach the closest palindromic prime.

The sequence of palindromic primes is number A002385 in the On-line Encyclopedia of Integer Sequences (OEIS).

Source code: palindromic-primes.py
Jonathan Frech's blog; built 2022/01/16 06:13:11 CET