Calculate the sequence where each term an is the smallest natural number greater than the previous term, that has exactly n divisors.



Task
Show here, on this page, at least the first 15 terms of the sequence.



See also
 OEIS:A069654


Related tasks
 Sequence: smallest number with exactly n divisors
 Sequence: nth number with exactly n divisors‎‎


MAX := 15
next := 1, i := 1
while (next <= MAX)
	if (next = countDivisors(A_Index)) 
		Res.= A_Index ", ", next++
MsgBox % "The first " MAX " terms of the sequence are:`n" Trim(res, ", ")
return
 
countDivisors(n){
	while (A_Index**2 <= n)
		if !Mod(n, A_Index)
			count += (A_Index = n/A_Index) ? 1 : 2
	return count
}