{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThis time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array $$$a$$$ of length $$$n$$$ written on it, and then he does the following:\u003c/p\u003e\u003cul\u003e \u003cli\u003e he picks a range $$$(l, r)$$$ and cuts the subsegment $$$a_l, a_{l + 1}, \\ldots, a_r$$$ out, removing the rest of the array. \u003c/li\u003e\u003cli\u003e he then cuts this range into multiple subranges. \u003c/li\u003e\u003cli\u003e to add a number theory spice to it, he requires that the elements of every subrange must have their product equal to their \u003ca href\u003d\"https://en.wikipedia.org/wiki/Least_common_multiple\"\u003eleast common multiple (LCM)\u003c/a\u003e. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFormally, he partitions the elements of $$$a_l, a_{l + 1}, \\ldots, a_r$$$ into contiguous subarrays such that the product of every subarray is equal to its LCM. Now, for $$$q$$$ independent ranges $$$(l, r)$$$, tell Baby Ehab the minimum number of subarrays he needs.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains $$$2$$$ integers $$$n$$$ and $$$q$$$ ($$$1 \\le n,q \\le 10^5$$$)\u0026nbsp;— the length of the array $$$a$$$ and the number of queries.\u003c/p\u003e\u003cp\u003eThe next line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, $$$\\ldots$$$, $$$a_n$$$ ($$$1 \\le a_i \\le 10^5$$$)\u0026nbsp;— the elements of the array $$$a$$$.\u003c/p\u003e\u003cp\u003eEach of the next $$$q$$$ lines contains $$$2$$$ integers $$$l$$$ and $$$r$$$ ($$$1 \\le l \\le r \\le n$$$)\u0026nbsp;— the endpoints of this query\u0027s interval.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each query, print its answer on a new line.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6 3\n2 3 10 7 5 14\n1 6\n2 4\n3 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n1\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe first query asks about the whole array. You can partition it into $$$[2]$$$, $$$[3,10,7]$$$, and $$$[5,14]$$$. The first subrange has product and LCM equal to $$$2$$$. The second has product and LCM equal to $$$210$$$. And the third has product and LCM equal to $$$70$$$. Another possible partitioning is $$$[2,3]$$$, $$$[10,7]$$$, and $$$[5,14]$$$.\u003c/p\u003e\u003cp\u003eThe second query asks about the range $$$(2,4)$$$. Its product is equal to its LCM, so you don\u0027t need to partition it further.\u003c/p\u003e\u003cp\u003eThe last query asks about the range $$$(3,5)$$$. You can partition it into $$$[10,7]$$$ and $$$[5]$$$.\u003c/p\u003e"}}]}