This page is still under construction.

Parts of this page are still being built. What you see may change.

Fibonomial

Time limit2sMemory limit512 MB

Summary
Count the exponent of each integer k from 2 to p in the product of the first n Fibonacci numbers.
Level

Hard8 of 10

Topics
Number theory, Math
Solved
No attempts yet

Problem

The Fibonacci sequence fnf_n is defined as follows.

f0=0,f1=1,fn=fn−1+fn−2    (n≥2)f_0 = 0, \quad f_1 = 1, \quad f_n = f_{n-1} + f_{n-2} \;\; (n \ge 2)

The Fibonomial FnF_n (n≥1n \ge 1) is defined as Fn=f1×f2×⋯×fnF_n = f_1 \times f_2 \times \cdots \times f_n, the product of f1f_1 through fnf_n.

For each integer kk with 2≤k≤p2 \le k \le p, write a program that reports how many times FnF_n has to be divided by kk before FnF_n is no longer divisible by kk.

Input

The first line holds two integers nn and pp, separated by one space. (1≤n≤1091 \le n \le 10^9, 2≤p≤1032 \le p \le 10^3)

Output

Print the answers on p−1p - 1 lines. Line ii (1≤i≤p−11 \le i \le p - 1) holds how many times FnF_n has to be divided by i+1i + 1 before FnF_n is no longer divisible by i+1i + 1.

Hint

F12=1570247078400=29×34×52×7×11×13×17×89F_{12} = 1570247078400 = 2^9 \times 3^4 \times 5^2 \times 7 \times 11 \times 13 \times 17 \times 89, so F12F_{12} can be divided by 22 nine times and by 44 four times.

Examples5

  1. Example 1

    Input
    12 6
    
    Expected output
    9
    4
    4
    2
    4
    
  2. Example 2

    Input
    1 2
    
    Expected output
    0
    
  3. Example 3

    Input
    2 5
    
    Expected output
    0
    0
    0
    0
    
  4. Example 4

    Input
    3 4
    
    Expected output
    1
    0
    0
    
  5. Example 5

    Input
    6 10
    
    Expected output
    4
    1
    2
    1
    1
    0
    1
    0
    1