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<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-10
#define PB push_back
#define fi first
#define se second
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<int,int> Pii;
typedef vector<int> vi;
int ans[1000001];
ll mod_pow(ll x, ll n ,ll mod){
	if(n == 0) return 1;
	ll res = mod_pow(x*x%mod,n/2,mod);
	if(n & 1) res = res * x % mod;
	return res;
}
void makeHammingNumbers(){
	rep(i,1000000){
		rep(j,10){
			if(mod_pow(60,j,i+1)==0){
				ans[i+1] = 1;
				break;
			}
		}
	}
	return ;
}
int main(){
	makeHammingNumbers();
	reps(i,1,1000000){
		ans[i+1] += ans[i];
	}
	int m;
	while(scanf("%d",&m),m){
		int n;
		scanf("%d",&n);
		printf("%d\n",ans[n]-ans[m-1]);
	}
	return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


bool isHam(int n){
    while(n%2==0)n/=2;
    while(n%3==0)n/=3;
    while(n%5==0)n/=5;
    if(n==1)return true;
    return false;
}

int main() {
    int m,n;
    while(cin>>m){
        if(m==0)break;
        cin>>n;
        
        int sum=0;
        for(int i=m;i<=n;i++){
            if(isHam(i))sum++;
        }
        cout<<sum<<endl;
    }

    return 0;
}

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

#define NMAX 1000000

int main() {
  int h[NMAX+1];
  int n[] = {2,3,5};
  int a, b, t;
  memset(h, 0, sizeof(h));
  h[1] = 1;
  for (int i=0; i<3; i++) {
    for (int j=1; j<=NMAX; j++) {
      if (!h[j]) continue;
      t = j * n[i];
      if (t <= NMAX) {
        h[t] = 1;
      }
    }
  }
  for (int i=0; i<NMAX; i++) {
    if (h[i]) cout << i << " ";
  }
  cout << endl;
  for (int i=1; i<=NMAX; i++) {
    h[i] += h[i-1];
  }
  while (1) {
    cin >> a;
    if (!a) break;
    cin >> b;
    cout << h[b]-h[a-1] << endl;
  }
  return 0;
}

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

const int MAX_NUM = 1000;

int main(){
	bool list[MAX_NUM + 1] = {0};
	
	for(int two = 0;two <= 20;two++){
		for(int three = 0;three <= 13;three++){
			for(int five = 0;five <= 9;five++){
				int num = pow(2, two) * pow(3, three) * pow(5, five);
				if(1 <= num && num <= MAX_NUM) list[num] = true;
			}
		}
	}
	int m, n;
	while(1){
		cin >> m;
		if(m == 0) break;
		cin >> n;
		int ans = 0;
		for(int i = m;i <= n;i++){
			if(list[i]) ans++;
		}
		cout << ans << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define MAX 1000010

int main(){
	int hamming[MAX];
	memset(hamming,0,sizeof(int)*MAX);
	hamming[0]=0;
	hamming[1]=1;
	long int tmp =0;
	for(int i=0;tmp<MAX;i++){
		for(int j=0;tmp<MAX;j++){
			for(int k=0;tmp<MAX;k++){
				tmp =pow(2,i)*pow(3,j)*pow(5,k);
				if(tmp<MAX){
					hamming[tmp]=1;
				}
			}
			tmp =pow(2,i)*pow(3,j+1)*pow(5,0);
		}
		tmp =pow(2,i+1)*pow(3,0)*pow(5,0);
	}
	
	
	int a,b;
	while(cin>>a,a!=0){
		cin>>b;
		int ans=0;
		for(int i=a;i<b+1;i++){
			ans+=hamming[i];
		}
		cout<<ans<<endl;
	}
	
}

C++: #include <cstdio>
#include <iostream>
#define MAX 1000001
#include <cmath>
using namespace std;

bool a[MAX];

int main(){
  int i,j,n,m,ans;
  for(i=1;i<MAX;i*=2) a[i] = true;
  for(i=1;i<MAX;i*=3) a[i] = true;
  for(i=1;i<MAX;i*=5) a[i] = true;
  for(i=1;i<MAX;i++){
    if(a[i]){
      if(i * 2 < MAX) a[i*2] = true;
      if(i * 3 < MAX) a[i*3] = true;
      if(i * 5 < MAX) a[i*5] = true;
    }
  }

  while(1){
    cin >> n;
    if(n == 0) break;
    cin >> m;
    ans = 0;
    for(i=n;i<=m;i++){
      if(a[i]){
	ans++;
      }
    }
    cout << ans << endl;

  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

const int MAX = 1000001;
int m, n;

int main (int argc, char *argv[]) {
    bool h[MAX];
    for(int i = 1; i < MAX; i *= 2){
        for(int j = i; j < MAX; j *= 3){
            for(int k = j; k < MAX; k *= 5) {
                h[k] = true;
            }
        }
    }
    while (cin >> m >> n, m) {
        int ans = 0;
        for (int i = m; i <= n; ++i) {
            if (h[i]) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int m, n;
  bool haming[1000001] = {};
  int sum[1000001] = {};

  for(int i = 1; i < 1000001; i *= 2){
    for(int j = i; j < 1000001; j *= 3){
      for(int k = j; k < 1000001; k *= 5){
        haming[k] = true;
      }
    }
  }
  haming[1] = true;
  for(int i = 1; i < 1000001; i++){
    sum[i] = sum[i - 1] + haming[i];
  }

  while(cin >> m){
    if(!m) break;
    cin >> n;
    cout << sum[n] - sum[m - 1] << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

set<int> hamming;
void make_hamming() {
  hamming.insert(1);
  for(int i=0; i<100; i++) {
    for(int j=0; j<100; j++) {
      for(int k=0; k<100; k++) {
	int temp = pow(2.0, i)*pow(3.0, j)*pow(5.0, k);
	hamming.insert(temp);
      }
    }
  }
}

int main() {
  make_hamming();
  int m, n;
  while(cin >> m >> n && m) {
    set<int>::iterator it = hamming.begin();
    int cnt = 0;
    for(it; it!=hamming.end(); it++) {
      if(m<=*it && *it <=n) cnt ++;
    }
    cout << cnt << endl;
  }
  return 0;
}

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

int main() {
	int n, m;

	while(cin >> m, m) {
		cin >> n;
		int ans = 0;

		for(; m <= n; m++) {
			int tmp = m;
			while(!(tmp % 2)) tmp /= 2;
			while(!(tmp % 3)) tmp /= 3;
			while(!(tmp % 5)) tmp /= 5;
			if(tmp == 1)
				ans++;
		}

		cout << ans << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;

bool check(int n){
  while(n%2==0){
    n/=2;
  }
  while(n%3==0){
    n/=3;
  }
  while(n%5==0){
    n/=5;
  }
  if(n==1){
    return true;
  }else{
    return false;
  }
}

int main(){
  int m,n;
  while(1){
    cin>>m;
    if(m==0)break;
    cin>>n;
    int ans=0;
    for(int i=m;i<=n;i++){
      if( check(i) ){
        ans++;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}