Go: package main

import (
	"bufio"
	"os"
		"strings"
	"strconv"
			"fmt"
	)

var scanner = bufio.NewScanner(os.Stdin)
const (
	MAX = 1000000
)
func main() {
	a := make([]int, MAX+1)
	a[1] = 1
	for i := 2; i <= MAX; i *= 2 {
		a[i]++
	}
	for i := 1; i <= MAX; i++ {
		if a[i] != 0 {
			for j := i*3; j <= MAX; j *= 3 {
				if a[j] == 0 {
					a[j]++
				}
			}
		}
	}
	for i := 1; i <= MAX; i++ {
		if a[i] != 0 {
			for j := i*5; j <= MAX; j *= 3 {
				if a[j] == 0 {
					a[j]++
				}
			}
		}
	}
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		m, _ := strconv.Atoi(buf[0])
		if m == 0 {
			break
		}
		n, _ := strconv.Atoi(buf[1])
		cnt := 0
		for i := m; i <= n; i++ {
			if a[i] != 0 {
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  const long long int MAX = 1000000LL;
  vector<long long int> hamming;

  long long int num = 1LL;
  for (int i = 0; ; ++i) {
    long long int five = num;
    for (int j = 0; j < i; ++j)
      five *= 5LL;

    if (five > MAX)
      break;

    for (int j = 0; ; ++j) {
      long long int three = five;
      for (int k = 0; k < j; ++k)
	three *= 3LL;

      if (three > MAX)
	break;

      for (int k = 0; ; ++k) {
	long long int two = three;
	for (int l = 0; l < k; ++l)
	  two *= 2;

	if (two > MAX)
	  break;
	hamming.push_back(two);
      }
    }
  }
  sort(hamming.begin(), hamming.end());

  long long int m, n;
  while (cin >> m >> n)
    cout << upper_bound(hamming.begin(), hamming.end(), n)
      - lower_bound(hamming.begin(), hamming.end(), m) << endl;
  return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

bool prime[10000];
int ans[1000001];

void erat()
{

    for (int i = 2; i < 10000; i++) {
        prime[i] = true;
    }

    for (int i = 2; i < 5000; i++) {
        if (prime[i]) {
            for (int j = 2; j*i < 10000; j++) {
                prime[i*j] = false;
            }
        }
    }
}

void solve()
{
    ans[0] = 0;
    for (int i = 1; i < 1000001; i++) {
        int fl = 1;
        for (int j = 7; j*j <= i; j++) {
            if (prime[j] && !(i % j)) {
                fl = 0;
                break;
            }
        }
        ans[i] = ans[i-1] + fl;
    }
}




int main() 
{
    int m, n;
    cin >> m;

    erat();
    solve();

    while (m) {
        cin >> n;
        cout << ans[n] - ans[m-1] << endl;
        cin >> m;
    }
    return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;

bool a[1000010];
int b[1000010]={0};

int main(){
	for(ll i=0;i<1000010;i++){
		a[i]=false;
	}
	a[1]=true;
	for(ll i=1;i<1000010;i++){
		if(a[i]){
			if(2*i<1000010) a[2*i]=true;
			if(3*i<1000010) a[3*i]=true;
			if(5*i<1000010) a[5*i]=true;
		}
	}
	/*
	rep(i,100){
		if(a[i]){
			cout<<i<<" ";
		}
	}
	cout<<endl;
	*/
	for(ll i=1;i<1000010;i++){
		//if(i==0) continue;
		b[i]=b[i-1];
		if(a[i]) b[i]++;
	}
	ll m,n;
	while(cin>>m,m){
		cin>>n;
		if(a[m]) cout<<b[n]-b[m]+1<<endl;
		else cout<<b[n]-b[m]<<endl;
	}
	return 0;
}

C++: #include <cstdio>
using namespace std;
int main(void){
  int i,n,m,x,count;
  char str[1000001];
 
  for( ; ; ){
    fgets(str,sizeof(str),stdin);
    sscanf(str,"%d %d",&m,&n);
    if(m == 0) break;
    count = 0;
    for(i=m; i<=n; i++){
      x = i; 
      for( ; ; ){
        if(x == 1){
          count++;
          break;}
        else if(x%2 == 0){
          x /= 2;}
        else if(x%3 == 0){
          x /= 3;}
        else if(x%5 == 0){
          x /= 5;}
        else
          break;
      }
    }
    printf("%d\n", count);
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int l, r;
	while (cin >> l >> r){
		int ans = 0;
		for (int i = l; i <= r; i++){
			int q = i;
			while (q % 2 == 0)q /= 2;
			while (q % 3 == 0)q /= 3;
			while (q % 5 == 0)q /= 5;
			if (q == 1)ans++;
		}
		cout << ans << endl;
	}
}

C++: #include<iostream>
using namespace std;
 
int dp[5000001] = {0};
int main() {
        int k,m,n;
        dp[1] = 1;
        for(int i = 1 ; i <= 1000000 ; i++){
                dp[i*2] |= dp[i];
                dp[i*3] |= dp[i];
                dp[i*5] |= dp[i];
        }
        for(int i = 1 ; i <= 1000000 ; i++){
                dp[i] += dp[i-1];
        }
        while(cin >> m && m){
                cin >> n;
                cout << dp[n] - dp[m-1] << endl;
        }
        return 0;
}

C++: #include<iostream>
using namespace std;
typedef long long L;
int main() {
	L m,n;
	L a = 1;
	for (int i = 0; i < 10; i++)a *= 60;
	while (cin >> m, m) {
		cin >> n;
		int ans = 0;
		for (L i = m; i <= n; i++) {
			if (a%i==0)ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  vi dp(1000001);
  dp[1] = 1;
  loop(i, 2, dp.size()) {
    if (i % 2 == 0) dp[i] |= dp[i / 2];
    if (i % 3 == 0) dp[i] |= dp[i / 3];
    if (i % 5 == 0) dp[i] |= dp[i / 5];
  }
  int m, n;
  while (cin >> m >> n, m) {
    int c = 0;
    for (int i = m; i <= n; i++) c += dp[i];
    cout << c << endl;
  }
}

C++: #include<queue>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

bool bh[1000001];

int main()
{
	priority_queue< int,vector<int>,greater<int> > pq;
	pq.push(1);	bh[1]=true;
	while(pq.top()<1000000){
		int a=pq.top();	pq.pop();
		if(2*a<=1000000&&!bh[2*a])	pq.push(2*a),bh[2*a]=true;
		if(3*a<=1000000&&!bh[3*a])	pq.push(3*a),bh[3*a]=true;
		if(5*a<=1000000&&!bh[5*a])	pq.push(5*a),bh[5*a]=true;
	}

	vector<int> ham;
	for(int i=0;i<=1000000;i++)	if(bh[i])	ham.push_back(i);

	for(int m,n;scanf("%d%d",&m,&n),m;){
		printf("%d\n",
			distance(lower_bound(ham.begin(),ham.end(),m),
					 upper_bound(ham.begin(),ham.end(),n))
		);
	}

	return 0;
}

C++: #include<stdio.h>
#include<queue>
using namespace std;
int h[1000001];
int main(){
	h[1]=1;
	for(int i=2;i<=1000000;i*=2)h[i]=1;
	for(int i=1;i<=1000000;i++){
		if(h[i]){
			for(int j=i*3;j<=1000000;j*=3)if(h[j]==0)h[j]=2;
		}
	}
	for(int i=1;i<=1000000;i++){
		if(h[i]){
			for(int j=i*5;j<=1000000;j*=5)if(h[j]==0)h[j]=3;
		}
	}
	int a,b;
	while(scanf("%d",&a),a){
		scanf("%d",&b);
		int ret=0;
		for(int i=a;i<=b;i++)if(h[i])ret++;
		printf("%d\n",ret);
	}
}