← Home
An efficient Go solution to the problem.

```go
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	// Configure fast I/O
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var X, k uint64
	// Read X and k
	if _, err := fmt.Fscan(reader, &X, &k); err != nil {
		return
	}

	// Case 1: X = 1. The sequence is always [1].
	if X == 1 {
		fmt.Fprint(writer, "1")
		return
	}

	// Case 2: k = 0. The sequence is [X].
	if k == 0 {
		fmt.Fprint(writer, X)
		return
	}

	// Case 3: k >= 100000.
	// For X > 1, the sequence X_k starts with at least k ones.
	// Since we only need the first 100000 elements, and k >= 100000,
	// the output is simply 100000 ones.
	if k >= 100000 {
		for i := 0; i < 100000; i++ {
			if i > 0 {
				writer.WriteByte(' ')
			}
			writer.WriteByte('1')
		}
		return
	}

	// Case 4: k < 100000. We perform a DFS on the divisor tree.
	
	// Step 4a: Find all divisors of X
	divs := make([]uint64, 0, 2048)
	for i := uint64(1); i*i <= X; i++ {
		if X%i == 0 {
			divs = append(divs, i)
			if i*i != X {
				divs = append(divs, X/i)
			}
		}
	}
	// Sort divisors to ensure correct order
	sort.Slice(divs, func(i, j int) bool { return divs[i] < divs[j] })

	// Step 4b: Build adjacency list (divisors for each divisor)
	// We map the index in `divs` to a list of indices of its divisors.
	n := len(divs)
	adj := make([][]int, n)
	for i := 0; i < n; i++ {
		val := divs[i]
		// Since divs is sorted, divisors of val are at indices <= i
		var children []int
		for j := 0; j <= i; j++ {
			if val%divs[j] == 0 {
				children = append(children, j)
			}
		}
		adj[i] = children
	}

	count := 0
	limit := 100000

	// Step 4c: DFS function
	var dfs func(uIdx int, depth uint64)
	dfs = func(uIdx int, depth uint64) {
		if count >= limit {
			return
		}
		
		// Base case: depth reached
		if depth == 0 {
			if count > 0 {
				writer.WriteByte(' ')
			}
			fmt.Fprint(writer, divs[uIdx])
			count++
			return
		}

		// Optimization: The divisor 1 (index 0) always expands to [1].
		// If current node is 1, just print 1.
		if uIdx == 0 {
			if count > 0 {
				writer.WriteByte(' ')
			}
			writer.WriteByte('1')
			count++
			return
		}

		// For any X > 1, the first divisor is 1.
		// Instead of recursing on 1 (which just outputs 1), handle it directly.
		if count > 0 {
			writer.WriteByte(' ')
		}
		writer.WriteByte('1')
		count++
		if count >= limit {
			return
		}

		// Recurse on other divisors
		children := adj[uIdx]
		// Skip the first child (index 0, value 1) as it's handled above
		for i := 1; i < len(children); i++ {
			dfs(children[i], depth-1)
			if count >= limit {
				return
			}
		}
	}

	// Start DFS from X (which is the last element in sorted divisors)
	dfs(n-1, k)
}
```