2 2
1 2 1 4 2 4
1 2 3 4 4 4
 2 2
1 2 0 9998 0 9999
2 1 0 9999 0 10000
 3 3
1 2 0 3 -4 7
2 3 -2 5 1 6
3 1 0 4 0 4
 2 2
1 2 0 3 0 3
2 1 0 4 0 4
 2 2
1 2 0 0 0 0
2 1 0 0 0 0
 5 10
4 3 -19 49 -11 65
4 4 50 12 -2 65
1 5 56 8 -5 76
5 1 -28 33 -38 49
4 2 0 0 2 9
4 2 0 0 14 8
3 1 26 67 15 85
5 3 -51 98 -44 99
1 3 -33 65 -20 65
3 4 30 6 -30 70
 5 10
4 3 -8 16 -29 72
4 4 -62 65 33 65
1 5 -58 97 -17 97
5 1 -5 10 -68 88
4 2 0 0 -9 60
4 2 0 0 -23 39
3 1 3 28 13 87
5 3 -1 25 -15 90
1 3 -12 33 6 94
3 4 -71 86 -39 86
 5 10
4 3 -1 5 -6 98
4 4 12 14 -43 98
1 5 -4 6 8 88
5 1 0 0 -9 100
4 2 0 0 6 50
4 2 0 0 -39 77
3 1 1 4 -1 100
5 3 -7 13 9 88
1 3 2 0 -7 100
3 4 2 0 3 88
 2 2
1 1 0 4 0 5
2 2 4 0 5 0
 2 2
1 2 0 4 0 4
2 1 0 4 0 4
 2 2
1 2 0 3 0 5
2 1 0 4 0 6

0
 1.0000000000
 0.2500000000
 0
 1.0000000000
 0.2121212000
 0.6666666000
 1.0000000000
 1.0000000000
 1.0000000000
 1.0000000000

#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
const int MAXX = 1e6;
int n, m, cnt;
long long sum[N << 2], maxn[N << 2];
long long div11[MAXX + 7], is_prime[MAXX + 7], low[MAXX + 7], prime[MAXX + 7];
void get_div() {
  div11[1] = 1;
  for (int i = 2; i <= MAXX; i++) {
    if (!is_prime[i]) {
      div11[i] = 2;
      low[i] = 1;
      prime[++cnt] = i;
    }
    for (int j = 1; j <= cnt && i * prime[j] <= MAXX; j++) {
      is_prime[i * prime[j]] = 1;
      if (i % prime[j] == 0) {
        div11[i * prime[j]] = div11[i] / (low[i] + 1) * (low[i] + 2);
        low[i * prime[j]] = low[i] + 1;
        break;
      } else {
        div11[i * prime[j]] = div11[i] << 1;
        low[i * prime[j]] = 1;
      }
    }
  }
}
void up(int o) {
  sum[o] = sum[(o << 1)] + sum[(o << 1 | 1)];
  maxn[o] = max(maxn[(o << 1)], maxn[(o << 1 | 1)]);
}
void build(int o, int l, int r) {
  if (l == r) {
    scanf("%d", &sum[o]);
    maxn[o] = sum[o];
    return;
  }
  build((o << 1), l, ((l + r) >> 1));
  build((o << 1 | 1), ((l + r) >> 1) + 1, r);
  up(o);
}
void change(int o, int l, int r, int L, int R) {
  if (maxn[o] <= 2) return;
  if (l == r) {
    sum[o] = maxn[o] = div11[sum[o]];
    return;
  }
  if (L <= ((l + r) >> 1)) change((o << 1), l, ((l + r) >> 1), L, R);
  if (R > ((l + r) >> 1)) change((o << 1 | 1), ((l + r) >> 1) + 1, r, L, R);
  up(o);
}
long long ask(int o, int l, int r, int L, int R) {
  if (L <= l && R >= r) {
    return sum[o];
  }
  long long res = 0;
  if (L <= ((l + r) >> 1)) res = ask((o << 1), l, ((l + r) >> 1), L, R);
  if (R > ((l + r) >> 1)) res += ask((o << 1 | 1), ((l + r) >> 1) + 1, r, L, R);
  return res;
}
int main() {
  get_div();
  scanf("%d%d", &n, &m);
  build(1, 1, n);
  for (int i = 1; i <= m; i++) {
    int opt, x, y;
    scanf("%d%d%d", &opt, &x, &y);
    if (opt == 1) {
      change(1, 1, n, x, y);
    }
    if (opt == 2) {
      cout << ask(1, 1, n, x, y) << "\n";
    }
  }
}
