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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int arr[1000010];
void SetHamming(int n,int k){
  if(n * k > 1000001) return ;
  if(arr[n*k] == 0){
    arr[n*k] = 1;
    SetHamming(n*k,2);
    SetHamming(n*k,3);
    SetHamming(n*k,5);
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m,n;
  SetHamming(1,1);
  while(1){
    cin >> m ;
    if(m == 0) break;
    cin >> n ;
    int ans = 0;
    REP(i,m,n+1){
      if(arr[i] == 1){
        ++ans;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
  int a,b;
  int x,y;
  cin>>a>>b;
  for(int i=a;i<=b;i++){
    x=i;
    while(x%2==0) if(x==0)break; x/=2;
    while(x%3==0) if(x==0)break; x/=3;
    while(x%5==0) if(x==0)break; x/=5;
    if(x==0)y++;
  }cout<<y<<endl;
  return 0;
}

C++: using namespace std;
int M=1000001;
int ish[1000001],nh[1000001];
int main(){
	for(int i=1;i<M;i*=2)for(int j=i;j<M;j*=3)for(int k=j;k<M;k*=5)ish[k]=1;
	for(int i=1;i<M;i++)nh[i]=nh[i-1]+ish[i];
	
	int n,m;
	while(cin>>m>>n,m)cout<<nh[n]-nh[m-1]<<endl;
	return 0;
}

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

int main(){
int sum[N];
bool ham[N];
int n,m;

for(int i=0;i<N;i++)ham[N] = false;

int tmp = 1;
int t2 = 1, t3 = 1;
while(tmp < N){
	while(tmp < N){
		while(tmp < N){
			ham[tmp] = true;
			tmp *= 5;
		}
		t3 *= 3;
		tmp = t3 * t2;
	}
	t2 *= 2;
	tmp = t2;
	t3 = 1;
}

tmp = 0;
for(int i=0;i<N;i++){
	if(ham[i])tmp++;
	sum[i] = tmp;
}

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

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

int main(){

	int n, m, cnt, h[1000001], p[1000001];

	fill(h, h+1000001, 0);

	for(int i=1; i<=1000000; i*=2){
		for(int j=1; i*j<=1000000; j*=3){
			for(int k=1; i*j*k<=1000000; k*=5){
				h[i*j*k] = 1;
			}
		}
	}
	
	cnt = 0;
	for(int i=0; i<=1000000; i++){
		if(h[i] == 1) cnt++;
		p[i] = cnt;
	}
	
	while(cin >> m){
		if(m == 0) break;
		cin >> n;
		if(h[m] == 1) cout << p[n] - p[m] + 1 << endl;
		else cout << p[n] - p[m] << endl;
	}

	return 0;

}

C++: #include<iostream>

int main(){
	int arr[1000001] = {0, 1, 1, 1, 1, 1};
	for(int i=6;i<=1000000;i++){
		if((i%2 == 0 && arr[i/2]) ||
			 (i%3 == 0 && arr[i/3]) ||
			 (i%5 == 0 && arr[i/5])){
			arr[i] = 1;
		}else{
			arr[i] = 0;
		}
	}

	int m, n;
	while(std::cin >> m >> n, m){
		int res = 0;
		while(m <= n){
			if(arr[m]){
				res++;
			}
			m++;
		}
		std::cout << res << std::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;
}

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

bool check(int n){
  while(n%2==0){
    n/=2;
  }
  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;
}

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

int main(){
	long long int A,B;
	int n[101][101][3]={};
	while(1){
		cin>>A;if(A==0)break;
		cin>>B;long long int g=60;
		/*
		for(int i=1;i<A;i++){
			g*=60;
			cout<<g<<endl;
		}
		*/

		
		int c=0;
		for(long long int i=A;i<=B;i++){g=60;
		for(long long int j=1;j<12;j++)
		{
			if(g%i==0){//cout<<g<<endl;
	//		cout<<i<<endl;
				c++;break;}
		else{g*=60;}
		}
		}
		cout<<c<<endl;
		
	}
	return 0;
}

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

const int MAX_NUM = 1000000;

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>
#include <algorithm>
#include <cstring>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int hum[1000001];

int main()
{	
	memset(hum,0,sizeof(hum));
	int count = 1;
	REP(i,1,1000001)
	{
		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)
		{
			hum[i] = count;
			count++;
		}
		else
		{
			hum[i] = hum[i-1];
		}
	}
	
	int n,m;
	while(cin >> n && n)
	{
		cin >> m;	
		cout << hum[m] - hum[n] + 1<< endl;
	}
	return 0;
}