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 <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> PL;

ll n, m;
ll a[1000100];
int main(){
	REP(i, 18){
		REP(j, 12){
			REP(k, 9){
				ll b = pow(2, i), d = pow(3, j), e = pow(5, k);
				if (b*d*e <= 1000000){
					a[b*d*e] = 1;
				}
			}
		}
	}
	while (cin >> m){
		if (m == 0)break;
		cin >> n;
		ll c = 0;
		FOR(i, m, n + 1){
			if (a[i]){
				c++;
			}
		}
		cout << c << endl;
	}
}

C++: #include <iostream>

int isHamming(int n)
{
	while (n%2==0) n/=2;
	while (n%3==0) n/=3;
	while (n%5==0) n/=5;
	return (n==1) ? 1 : 0;
}

int main()
{
	int m, n;
	while (true) {
		std::cin >> m;
		if (m==0) break;
		std::cin >> n;
		int res = 0;
		for (int i=m; i<=n; i++) {
			res += isHamming(i);
		}
		std::cout << res << std::endl;
	}
	return 0;
}

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

const int N = 1000000;
bool haming[N];

int main(){
    int m, n;
    fill(haming, haming + N, false);
    for(int i = 1;i < N;++i){
        int t = i;
        while((t & 1) != 1) t >>= 1;
        while(t % 3 == 0) t /= 3;
        while(t % 5 == 0) t /= 5;
        if(t == 1) haming[i] = true;
    }
    while(cin >> m, m){
        int c = 0;
        cin >> n;
        for(int i = m; i <= n;++i){
            if(haming[i]) ++c;
        }
        cout << c << endl;
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;

int t[1000000 + 1];

void init(){
	int n = 1000000 + 1;
	t[1] = 1;
	for(int i = 1; i < n; i++){
		if(t[i]){
			if(i*2<n) t[i*2] = 1;
			if(i*3<n) t[i*3] = 1;
			if(i*5<n) t[i*5] = 1;
		}
	}
	for(int i = 1; i <= n; i++) t[i] += t[i-1];
}

int main(){
	init();
	int n;
	while(cin>>n,n){
		int m; cin>>m;
		int ans = t[m]-t[n-1];
		cout << ans << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int m,n,ans;
	while(cin>>m,m){
		cin>>n;
		ans=0;
	for(int i=1;i<=n;i*=5)
	for(int j=i;j<=n;j*=3)
	for(int k=j;k<=n;k*=2){
		if(k>=m)
		ans++;
	}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<set>
#include<string>
using namespace std;
set<long long>a;
int main() {
	long long b, c,sum = 1;
	for (int i = 0; i <= 19; i++) {
		b = sum;
		for (int j = 0; j <= 12; j++) {
			c = sum;
			if (sum > 1000000)
				break;
			for (int z = 0; z <= 8; z++) {
				a.insert(sum);
				if (sum > 1000000)
					break;
				sum *= 5;
			}
			sum = c;
			sum *= 3;
		}
		sum = b;
		sum *= 2;
	}
	int m, n,o=0;
	string d, h = "";
	while (getline(cin, d)) {
		m = 0;
		n = 0;
		o = 0;
		if (d.length() == 1) break;
		d += " ";
		h = "";
		for (int i = 0; i < d.length(); i++) {
			if (d[i] == ' ') {
				if (o == 0) m = atoi(h.c_str());
				else n = atoi(h.c_str());
				o++;
				h = "";
			}
			else
				h += d[i];
		}
		set<long long>::iterator it = a.begin();
		int sum = 0;
		while ((*it) < m) {
			it++;
			if (it == a.end()) break;
		}
		while ((*it) >= m && (*it) <= n)
		{
			it++;
			sum++;
			if (it == a.end()) break;
		}
		cout << sum << endl;
	}
}

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

int main() {
    while (true) {
        int start, end;
        cin >> start >> end;
        if (start == 0) {
            break;
        }
        int count = 0;
        for (int i = start; i <= end; i++) {
            int temp = i;
            while (temp > 1) {
                if (temp % 2 == 0) {
                    temp /= 2;
                } else if (temp % 3 == 0) {
                    temp /= 3;
                } else if (temp % 5 == 0) {
                    temp /= 5;
                } else {
                    break;
                }
            }
            if (temp == 1) {
                count++;
            }
        }
        cout << count << endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int MAX=1000001;
    bool hamming[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)hamming[k]=1;
        }
    }
    int m;
    while(cin>>m,m){
        int n,co=0;
        cin>>n;
        for(int i=m;i<=n;i++)if(hamming[i])co++;
        cout<<co<<endl;
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> PL;

ll n, m;

int main(){
	while (cin >> m >> n){
		ll c = 0, x = pow(60.0, 10.0);
		FOR(i, m, n + 1){
			if (x % i == 0){
				c++;
			}
		}
		cout << c << endl;
	}
}

C++: #include<iostream>
#include<cmath>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	vector<int> vec;
	rep(i,1000001){
		vec.push_back(0);
	}
	rep(i,20){
		rep(j,13){
			rep(k,9){
				long long num=pow(2,i)*pow(3,j)*pow(5,k);
				if(num<=1000000)vec[num]=1;
			}
		}
	}
	long long start,end;
	while(cin>>start){
		if(start==0)break;
		cin>>end;
		int cnt=0;
		loop(i,start,end+1){
			if(vec[i]==1)cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

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

int dp[1000001];

int main() {
    for (int i = 1; i < 1000001; i++) {
        int num = i;
        while (num % 2 == 0) num /= 2;
        while (num % 3 == 0) num /= 3;
        while (num % 5 == 0) num /= 5;
        if (num == 1) dp[i] = 1;
        dp[i] += dp[i-1];
    }

    int M, N;
    while (cin >> M, M) {
        cin >> N;
        cout << dp[N] - dp[M-1] << endl;
    }


    return 0;
}