## A285494

The On-Line Encyclopedia of Integer Sequences gets regularly updated with new integer sequences. One of the recent updates was contributed by me, A285494.

A285494 is the list of all numbers $k$ so that its digit sum equals its number of distinct prime factors.
A number’s digit sum is the sum of all of its decimal digits. The number $62831853$, for example, has a digit sum of $6+2+8+3+1+8+5+3 = 36$.
A number’s number of distinct prime factors is the number of different prime numbers that multiply together to result in the original number. As an example, $62831853 = 3^2 \cdot 7 \cdot 127 \cdot 7853$, so it has five prime factors of which four are distinct.
Thereby one can conclude that $62831853$ is not an entry in this sequence, as $36 \neq 4$.

The sequence is certainly infinite, as the number $k = 2 \cdot 10^n$ with $n \in \mathbb{N}^*$ has a digit sum of $2 + (0 \cdot n) = 2$ and — because $k = 2^{n+1} \cdot 5^n$ — exactly two distinct prime factors.

In the encyclopedia entry, I provided a Mathematica one-liner to compute the first few entries of this sequence. Since then, I have also written a Python two-liner to achieve the same goal.

(* Mathematica *)
Select[Range[2,10000],Total[IntegerDigits[#]]==Length[FactorInteger[#]]&]
Out = {20, 30, 102, 120, 200, 300, 1002, 1200, 2000, 2001, 2002, 3000, 3010}

# Python 2.7
>>> def p(n):exec"i,f=2,set()\nwhile n>1:\n\tif n%i==0:f.add(i);n/=i;i=1\n\ti+=1";return len(f)
>>> print filter(lambda n:p(n)==sum(map(int,str(n))),range(2,10001))
[20, 30, 102, 120, 200, 300, 1002, 1200, 2000, 2001, 2002, 3000, 3010]


## JClock VIII

Interpreting the hour hand on a clock as a two-dimensional object on a plane, the hand’s tip can be seen as a complex number.
This clock converts the hour hand’s position into a complex number, sets the number’s length to the current minutes and displays it in the form $a + b \cdot i$.
The angle $\phi$ is determined by the hours passed ($\frac{2 \cdot \pi \cdot \text{hour}}{12} = \frac{\pi \cdot \text{hour}}{6}$) but has to be slightly modified because a complex number starts at the horizontal axis and turns anti-clockwise whilst an hour hand starts at the vertical axis and turns — as the name implies — clockwise.
Thus $\phi = (2 \cdot \pi - \frac{\pi \cdot \text{hour}}{6}) + \frac{\pi}{2} = (\frac{15 - \text{hour}}{6}) \cdot \pi$.
The complex number’s length is simply determined by the minutes passed. Because the length must not be equal to $0$, I simply add 1. $|z| = k = \text{minute} + 1$.
Lastly, to convert a complex number in the form $k \cdot e^{\phi \cdot i}$ into the form $a + b \cdot i$, I use the formula $k \cdot (\cos{\phi} + \sin{\phi} \cdot i) = a + b \cdot i$.

# Python 2.7.7 Code
# Pygame 1.9.1 (for Python 2.7.7)
# Jonathan Frech 29th of July, 2016

## 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