## A278328

The On-Line Encyclopedia of Integer Sequences (also known by its acronym, OEIS) is a database hosting hundreds of thousands of — as the name implies — integer sequences. Yet, despite the massive number of entries, I contributed a new integer sequence, A278328.

A278328 describes numbers whose absolute difference to their decimal reverse are square. An example would be $12$ or $21$ (both are the decimal reverse to each other), since $\left|12-21\right|=9$ and $9=3^2$.

Not a whole lot is known about the sequence, partly due to its definition only resulting in the sequence when using the decimal system, though it is known that there are infinitely many numbers with said property. Since there are infinitely many palindromes (numbers whose reverse is the number itself), $\left|n-n\right|=0$ and $0=0^2$.

Due to there — to my knowledge — not being a direct formula for those numbers, I wrote a Python script to generate them. On the sequence’s page, I posted a program which endlessly spews them out, though I later wrote a Python two-liner, which only calculates those members of the sequence in the range from $0$ to $98$ (shown below entered in a Python shell).

>>> import math
>>> filter(lambda n:math.sqrt(abs(n-int(str(n)[::-1])))%1 == 0, range(99))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 21, 22, 23, 26, 32, 33, 34, 37, 40, 43, 44, 45, 48, 51, 54, 55, 56, 59, 62, 65, 66, 67, 73, 76, 77, 78, 84, 87, 88, 89, 90, 95, 98]

## Triangular Squares

In a recent video Matt Parker showed a triangular number that also is a square number, 6, and asked if there were more.

A triangular number has the form $\frac{n^2+n}{2}$ — shown by Euler — and a square number has the form $m^2$.
Triangular squares are those numbers for which $\frac{n^2+n}{2} = m^2$ with $n,m \in \mathbb{N}$.
Examples are $\{0, 1, 6, 35, 204, 1189, 6930, \dots\}$ (sequence A001109 in OEIS).

To check if triangular numbers are square numbers is easy (code listed below), but a mathematical function would be nicer.
The first thing I tried was to define the triangular number’s square root as a whole number, $\sqrt{\frac{n^2+n}{2}} = \lfloor \sqrt{\frac{n^2+n}{2}} \rfloor$. This function does not return the square numbers that are triangular but the triangular numbers that are square.
The resulting sequence is $\{0, 1, 8, 49, 288, 1681, 9800, \dots\}$ (sequence A001108 in OEIS).

# Python 2.7.7 Code
# Jonathan Frech 13th of July, 2016
#         edited 15th of July, 2016

## Rotating Squares

Using the pygame.transform.rotozoom() function, a velocity argument and changing colors, this program rotates squares across the screen.

#### Controls

• Left click spawns in a new square at current mouse position
• Space takes a screenshot

# Python 2.7.7 Code
# Pygame 1.9.1 (for Python 2.7.7)
# Jonathan Frech 27th of November, 2015
#         edited  2nd of January , 2016