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 <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

signed main(){
    
    vector<int> acc(5000000, 0);
    acc[1] = 1;
    for(int i = 1; i <= 1000100; i++){
        if(acc[i] == 0) continue;
        acc[i * 2] = 1;
        acc[i * 3] = 1;
        acc[i * 5] = 1;
    }

    for(int i = 2; i <= 1000100; i++) acc[i] += acc[i - 1];
    
    while(1){
        int n, m; cin >> n >> m;
        if(n == 0) break;
        cout << acc[m] - acc[n - 1] << endl;
    }
    return 0;
}

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

bool hamming[MAX+1];
void init(){
	hamming[1]=true;
	for(int i=1;i<=MAX/2;i++){
		if(!hamming[i])continue;
		hamming[i*2]=true;
		if(i*3<=MAX)hamming[i*3]=true;
		if(i*5<=MAX)hamming[i*5]=true;
	}
}
int main(){
	int m,n;
	init();
	while(cin>>m>>n,m||n)cout<<count(hamming+m,hamming+(n+1),true);
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
    vector<bool> haming(1e6+1,false);
    queue<int> q;
    q.push(1);
    int x[] = {2,3,5};
    while(!q.empty()){
	int now = q.front();
	//cout<<now<<endl;
	q.pop();
	if(now > 1e6)continue;
	if(haming[now]) continue;
	haming[now] = true;
	for(int i=0;i<3;i++) q.push( now*x[i]);
    }
  //  cout<<"ok"<<endl;
    vector<int> cnt(1e6+1,0);
    for(int i=1;i<1e6+1;i++){
	int tmp = 0;
	if(haming[i] ) tmp++;
	cnt[i] = cnt[i-1] + tmp;
    }
    while(1){
	int n,m;
	cin>>n;
	if(n==0)break;
	cin>>m;
	cout<<cnt[m]-cnt[n-1]<<endl;
    }

	return 0;
}

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

int hamming(int n);

int main(void){
  int m,n;
  int retval;
  int hammingList[1000001];
  for(int i=0;i<=1000000;i++){
    hammingList[i]=hamming(i);
  }

  while(cin>>m>>n){
    retval=0;
    for(int i=m;i<=n;i++){
      retval+=hammingList[i];
    }
    cout<<retval<<endl;
  }
  return 0;
}

int hamming(int n){
  while(n>1){
    if((n/2)*2==n){
      n=n/2;
    }
    else{
      break;
    }
  }
  while(n>1){
    if((n/3)*3==n){
      n=n/3;
    }
    else{
      break;
    }
  }
  while(n>1){
    if((n/5)*5==n){
      n=n/5;
    }
    else{
      break;
    }
  }
  if(n==1) return 1;
  else return 0;
}

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(){
	for (int i = 1; i <= 1000000; i *= 2){
		for (int j = 1; j*i <= 1000000; j *= 3){
			for (int k = 1; k*j*i <= 1000000; k *= 5){
				a[i*j*k] = 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>
#include <stdio.h>

using namespace std;
int s[1000001];
int main() {
int m,n,c2,c3,c5,i,k=0;
for (c5=1;c5<=1000000;c5*=5) for (c3=1;c3*c5<=1000000;c3*=3) for (c2=1;c2*c3*c5<=1000000;c2*=2) s[c2*c3*c5]=1;
for (i=0;i<=1000000;i++) { k+=s[i]; s[i]=k; }
while(cin >> m) {
	if (m==0) break;
	cin >> n;
	cout << s[n]-s[m-1] << endl;
	}
return 0;
 }

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

bool ham(int n){
	while(n%2==0)n/=2;
	while(n%3==0)n/=3;
	while(n%5==0)n/=5;
	return n==1;
}

int main() {
	int n,m;
	while(n=in()){
		m=in();
		int res=0;
		for(;n<=m;n++){
			if(ham(n))res++;
		}
		cout<<res<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	long long m, n;
	vector<long long>l;
	while (cin >> m){
		if (m == 0)break;
		cin >> n;
		long long sum = 0;
		for (int i = m; i <=n; i++){
			if (2^22 * 3^15 * 5^10 % i == 0){
				sum++;
			}
		}
		l.push_back(sum);
	}
	for (long long i : l) {
		cout << i << endl;
	}
	char c;
	cin >> c;
}

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;
	a *= 9;
	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++: #include<iostream>
using namespace std;

bool ham[1000001];
int m,n;

void solve(){
	ham[1] = true;
	for(int i=2; i<1000001; i++)
		ham[i] = false;
	for(int i=1; i<1000001; i++){
		if(ham[i]){
			for(int j=i*2; j<1000001; j*=2)
				ham[j] = true;
			for(int j=i*3; j<1000001; j*=3)
				ham[j] = true;
			for(int j=i*5; j<1000001; j*=5)
				ham[j] = true;
		}
	}
}

int main(){
	solve();
	while(true){
		cin >> m;
		if(!m)
			return 0;
		cin >> n;
		int ans = 0;
		for(int i=m; i<=n; i++)
			if(ham[i])
				ans++;
		cout << ans << endl;
	}
}

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

int main(){
	int x=100000;
	bool isHamming[x];
	isHamming[0]=false;
		for(int i=1; i<x; i++)
		isHamming[i]=true;
	for(int i=1; i<x; i++){
		int j=i;
		while(j%2==0)
			j=j/2;
		while(j%3==0)
			j=j/3;
		while(j%5==0)
			j=j/5;
		if(j==1)
			isHamming[i]=false;
	}
	
	while(true){
		int m,n;
		cin >> m;

		if(m==0)
			break;

		cin >> n;
	
		int ans=0;
		for(int i=m; i<=n; i++){
			if(isHamming[i])
				ans++;
		}
		cout << ans<< endl;
	}
	return 0;
}

C++: // AOJ 0162
#include <iostream>

using namespace std;

bool is_hamming(int num){
	while (num % 2 == 0){
		num /= 2;
	}
	while (num % 3 == 0){
		num /= 3;
	}
	while (num % 5 == 0){
		num /= 5;
	}

	return (num == 1);
}

int main(void)
{
	int m, n;
	while (cin >> m, m){
		cin >> n;
		int ret = 0;
		for (int i = m; i <= n; i++){
			if (i == 1){
				ret++;
				continue;
			}
			if (is_hamming(i)){
				ret++;
				// cout << i << endl;
			}
		}
		cout << ret << endl;
	}

	return 0;
}