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 <set>
#define M 1000001
using namespace std;

int a[M];
int main(){
  set<int> s;
  int t,u;
  s.insert(1);
  s.insert(2);
  s.insert(3);
  s.insert(5);
  set<int>::iterator ite=s.begin();
  while((t=*ite)<M){
    if(t*2>t)s.insert(t*2);
    if(t*3>t)s.insert(t*3);
    if(t*5>t)s.insert(t*5);
    ite++;
  }
  for(ite=s.begin();*ite<M;ite++)a[*ite]=1;
  for(t=0;t<M;t++)a[t]+=a[t-1];
  for(;scanf("%d",&t),t;printf("%d\n",a[u]-a[t-1]))
    scanf("%d",&u);
}

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

int h[1000001];
int dp[1000001];
int d[3]={2,3,5};
void ham(int s){
	memset(h,0,sizeof(h));
	memset(dp,0,sizeof(dp));
	h[1]=1;
	for(int i=0;i<3;i++){
		for(int j=1;j<=s;j++){
			if(h[j/d[i]]==1 && j%d[i]==0)h[j]=1;
		}
	}
	for(int i=1;i<=s;i++){
		dp[i]=dp[i-1]+h[i];
	}
}

int main(void){
	ham(1000000);
	while(1){
		int m,n;
		scanf("%d",&m);
		if(m==0)break;
		scanf("%d",&n);
		printf("%d\n",dp[n]-dp[m-1]);
	}
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

vector<int> hamming;
set<int> used;
void add_hamming(int n)
{
	if (n > 1000000 || used.count(n))
		return;
	used.insert(n);
	hamming.push_back(n);
	add_hamming(2*n);
	add_hamming(3*n);
	add_hamming(5*n);
}
int main()
{
	add_hamming(1);
	sort(hamming.begin(), hamming.end());

	int n, m;
	while (scanf("%d %d", &n, &m), n)
		printf("%d\n", upper_bound(hamming.begin(), hamming.end(), m)
		- lower_bound(hamming.begin(), hamming.end(), n));

	return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(), c_end=c.end(); it!=c_end; ++it)

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

int main(){
	// respect http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=226655#1
	fastIO;
	int m = 0, n = 0, out = 0;

	while (cin >> m, m){
		cin >> n;
		out = 0;
		for (int i = m; i <= n; i++)
			if (solve2(i))
				out++;
		cout << out << endl;
	}
	return 0;
}

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

using namespace std;

long long power(int a, int b)
{
	if (b == 0) { return 1LL; }

	return power(a, b - 1) * a;
}

int main()
{
	vector<bool> s(1000001, false);

	for (int i = 0; i < 20; i++)
	{
		for (int j = 0; j < 12; j++)
		{
			for (int k = 0; k < 8; k++)
			{
				long long sum = power(2, i) * power(3, j) * power(5, k);

				if (sum <= 1000000LL)
				{
					s[sum] = true;
				}
			}
		}
	}

	int m, n;

	while (true)
	{
		cin >> m >> n;

		if (m == 0 && n == 0) { break; }

		int sum = 0;

		for (int i = m; i <= n; i++)
		{
			sum += (s[i] ? 1 : 0);
		}

		cout << sum << endl;
	}

	return 0;
}

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

int main(){
	int m, n;
	while(cin >> m >> n, m){
		int ans = 0;
		for(int i = m; i <= n; i++){
			int num = i;
			while(1){
				if(num == 1){
					ans++;
					break;
				}
				else if(num % 2 != 0 && num % 3 != 0 && num % 5 != 0) break;
				if(num % 2 == 0) num /= 2;
				else if(num % 3 == 0) num /= 3;
				else if(num % 5 == 0) num /= 5;
			}
		}
		cout << ans << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int m;
    while(cin>>m,m){
        int n,co=0;
        cin>>n;
        for(int i=m;i<=n;i++){
            if(i==1)co++;
            else{
                long long int kawa=60;
                for(int j=0;j<10;j++){
                    if(kawa%i==0){
                        co++;
                        break;
                    }
                    kawa*=60;
                }
            }
        }
        cout<<co<<endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
bool ham[1000001];
int main(){
  ham[1]=1;
  for(int i=0;i<1000001;i++)
    if(ham[i]){
      if(i*2<=1000000)ham[i*2]=1;
      if(i*3<=1000000)ham[i*3]=1;
      if(i*5<=1000000)ham[i*5]=1;
    }
  int x,y;
  while(cin>>x,x){
    cin>>y;
    int sum=0;
    for(int i=x;i<=y;i++)
      if(ham[i])sum++;
    cout<<sum<<endl;
  }
}

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>>B;
		if(A==0&&B==0)break;
		long long int g=60;int c=0;
		for(long long int i=A;i<=B;i++){g=60;
		for(long long int j=1;j<20;j++)
		{
			if(g%i==0){//cout<<g<<endl;
			c++;break;}
		else{g*=60;}
		}
		}
		cout<<c<<endl;
		
	}
	return 0;
}

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=2; i<x; i++){
		int j=i;
		while(j!=1){
			if(j%2==0)
				j=j/2;
			else if(j%3==0)
				j=j/3;
			else if(j%5==0)
				j=j/5;
			else{
				isHamming[i]=false;
				break;
			}
		}
	}
	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;
}