A282693 Numbers k such that k = (sum of digits of k)*((sum of digits of k) + 1).
0, 12, 42, 90, 156
Offset: 1
Examples
0 = 0*(0+1). 12 = (1+2)*(1+2+1). 42 = (4+2)*(4+2+1). 90 = (9+0)*(9+0+1). 156 = (1+5+6)*(1+5+6+1).
Programs
-
Mathematica
fQ[n_] := Block[{a = Plus @@ IntegerDigits@ n}, a*(a +1) == n]; Select[ Range[0, 1000], fQ] (* Robert G. Wilson v, Feb 24 2017 *)
-
VBA
Sub calcul() Sheets("Result").Select Range("A1").Select For i = 1 To 10000000 Sum = 0 For k = 1 To Len(i) Sum = Sum + Mid(i, k, 1) Next res = Sum * (Sum + 1) If res = i Then ActiveCell.Value = i ActiveCell.Offset(1, 0).Select End If Next End Sub