about summary refs log tree commit diff
path: root/others/other/prodig.go
blob: e269ee1204b7def5caf17a9a86ea75b1f388db10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import "fmt"

func main() {
	var T, N int
	fmt.Scan(&T)
	for ; T > 0; T-- {
		var s string
		fmt.Scan(&N)
		for i := 9; i > 1; i-- {
			for N%i == 0 {
				N /= i
				s = fmt.Sprint(i) + s
			}
		}
		if len(s) > 0 {
			println(s)
		} else {
			println(1)
		}
	}
}