//#pragma GCC optimize("O3, unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define fr(n) for(ll i = 0; i < n; i++)
#define rep(i,a,b) for(int i = a; i < b; i++)
#define vll vector<pair<ll,ll>>
#define vii vector<pair<int,int>>
#define pi acos(-1)
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define print(a) for(auto x:(a))cout << x <<
#define ios ios::sync_with_stdio(0);cin.tie(0);
#define endl "\n"
#define INF (ll)1e15
#define int ll
using namespace std;
const int MAXN = 1e6 + 5;
int arr[MAXN];
vector<int> D(MAXN, 1);
void precompute_D() {
for (int i = 2; i < MAXN; ++i) {
for (int j = i; j < MAXN; j += i) {
D[j]++;
}
}
}
class FenwickTree {
vector<int> bit;
int n;
public:
FenwickTree(int size) : n(size), bit(size + 1, 0) {}
void update(int index, int delta) {
for (++index; index <= n; index += index & -index)
bit[index] += delta;
}
int query(int index) {
int sum = 0;
for (++index; index > 0; index -= index & -index)
sum += bit[index];
return sum;
}
int rangeQuery(int left, int right) {
return query(right) - query(left - 1);
}
};
void solve(){
int N, Q; cin >> N >> Q;
FenwickTree fenwick(N);
map<int,int> alive;
rep(i,0,N){
cin >> arr[i];
fenwick.update(i,arr[i]);
if(arr[i]>2) alive.emplace_hint(alive.end(),i,arr[i]);
}
while(Q--){
int t; cin >> t;
int l, r; cin >> l >> r;
l--; r--;
if(t==1){
auto it = alive.lower_bound(l);
while(it!=alive.end()&&it->first<=r){
auto nxt = it;++nxt;
int x = it->second;
int xnew = D[x];
fenwick.update(it->first, xnew-x);
if(xnew>2) it->second = xnew;
else alive.erase(it);
it = nxt;
}
}else {
cout << fenwick.rangeQuery(l, r) << endl;
}
}
}
int32_t main() {
ios
int t = 1;
precompute_D();
//cin >> t;
while(t--)solve();
return 0;
}
Ly8jcHJhZ21hIEdDQyBvcHRpbWl6ZSgiTzMsIHVucm9sbC1sb29wcyIpCgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KCiNkZWZpbmUgbGw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IGZvciAoKytpbmRleDsgaW5kZXggPD0gbjsgaW5kZXggKz0gaW5kZXggJiAtaW5kZXgpCiAgICAgICAgICAgIGJpdFtpbmRleF0gKz0gZGVsdGE7CiAgICB9CgogICAgaW50IHF1ZXJ5KGludCBpbmRleCkgewogICAgICAgIGludCBzdW0gPSAwOwogICAgICAgIGZvciAoKytpbmRleDsgaW5kZXggPiAwOyBpbmRleCAtPSBpbmRleCAmIC1pbmRleCkKICAgICAgICAgICAgc3VtICs9IGJpdFtpbmRleF07CiAgICAgICAgcmV0dXJuIHN1bTsKICAgIH0KCiAgICBpbnQgcmFuZ2VRdWVyeShpbnQgbGVmdCwgaW50IHJpZ2h0KSB7CiAgICAgICAgcmV0dXJuIHF1ZXJ5KHJpZ2h0KSAtIHF1ZXJ5KGxlZnQgLSAxKTsKICAgIH0KfTsKCnZvaWQgc29sdmUoKXsKICAgIGludCBOLCBROyBjaW4gPj4gTiA+PiBROwogICAgRmVud2lja1RyZWUgZmVud2ljayhOKTsKICAgIG1hcDxpbnQsaW50PiBhbGl2ZTsKICAgIHJlcChpLDAsTil7CiAgICAJY2luID4+IGFycltpXTsKICAgIAlmZW53aWNrLnVwZGF0ZShpLGFycltpXSk7CiAgICAJaWYoYXJyW2ldPjIpIGFsaXZlLmVtcGxhY2VfaGludChhbGl2ZS5lbmQoKSxpLGFycltpXSk7CiAgICB9CiAgICAKICAgIHdoaWxlKFEtLSl7CiAgICAgICAgaW50IHQ7IGNpbiA+PiB0OwogICAgICAgIGludCBsLCByOyBjaW4gPj4gbCA+PiByOwogICAgICAgIGwtLTsgci0tOwogICAgICAgIAogICAgICAgIGlmKHQ9PTEpewogICAgICAgICAgICBhdXRvIGl0ID0gYWxpdmUubG93ZXJfYm91bmQobCk7CiAgICAgICAgICAgIHdoaWxlKGl0IT1hbGl2ZS5lbmQoKSYmaXQtPmZpcnN0PD1yKXsKICAgICAgICAgICAgCWF1dG8gbnh0ID0gaXQ7KytueHQ7CiAgICAgICAgICAgIAkKICAgICAgICAgICAgCWludCB4ID0gaXQtPnNlY29uZDsKICAgICAgICAgICAgCWludCB4bmV3ID0gRFt4XTsKICAgICAgICAgICAgCWZlbndpY2sudXBkYXRlKGl0LT5maXJzdCwgeG5ldy14KTsKICAgICAgICAgICAgCQogICAgICAgICAgICAJaWYoeG5ldz4yKSBpdC0+c2Vjb25kID0geG5ldzsKICAgICAgICAgICAgCWVsc2UgYWxpdmUuZXJhc2UoaXQpOwogICAgICAgICAgICAJaXQgPSBueHQ7CiAgICAgICAgICAgIH0KICAgICAgICB9ZWxzZSB7CiAgICAgICAgICAgIGNvdXQgPDwgZmVud2ljay5yYW5nZVF1ZXJ5KGwsIHIpIDw8IGVuZGw7CiAgICAgICAgfQogICAgfQp9CgoKCmludDMyX3QgbWFpbigpIHsKICAgIGlvcwogICAgaW50IHQgPSAxOwogICAgcHJlY29tcHV0ZV9EKCk7CiAgICAvL2NpbiA+PiB0OwogICAgd2hpbGUodC0tKXNvbHZlKCk7CgogICAgcmV0dXJuIDA7Cn0=