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>
using namespace std;

int main()
{

  while(1){
  
    int m,n,cnt=0;
    cin >> m >> n;
    
    if(m==0)
      return 0;
      
    for(int i=n; m<=i; i--){
      if(i=1){
        cnt++;
        continue;
      }
      int a=i;
      while(a!=0){
        
        if(a/2==0)
          a=a/2;
        else  if(a/3==0)
          a=a/3;
        else  if(a/5==0)
          a=a/5;
        else
          break;
      }
     if(a==0)
       cnt++;
     }
     
     cout << cnt << endl;
     
   }
  
  return 0;
  
}

C++: #include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

constexpr int LIM = 10000001;
char h[LIM];
int sh[LIM];

bool solve() {
    int m, n;
    cin >> m;
    if (m == 0) { return false; }
    cin >> n;
    cout << (sh[n] - sh[m-1]) << endl;
    return true;
}

int main() {
    h[1] = 1;
    sh[0] = 0;
    for (int j = 1; j < LIM; ++j) {
        if (j % 2 == 0) { h[j] |= h[j/2]; }
        if (j % 3 == 0) { h[j] |= h[j/3]; }
        if (j % 5 == 0) { h[j] |= h[j/5]; }
        sh[j] = sh[j-1] + h[j];
    }
    while(solve());
    return 0;
}

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

int main(){
  int m;
  int n,a,cnt;
  m =0 , n=0, a=0, cnt =0;
  while(1){
    cin >> m;
    if(m == 0) break;
    cin >> n;
 
    for(int i=m;i<n;i++){
      a = i;
      
      while(a % 2 ==0) a = a / 2;
      while(a % 3 ==0) a = a / 3;
      while(a % 5 ==0) a = a / 5;

      if(a == 1) cnt++;
    }


    cout << cnt << endl;
    cnt =0;

  }



}

C++: #include<iostream>
using namespace std;
 
int dp[5000001] = {0};
int main() {
        int k,m,n;
        dp[1] = 1;
        for(int i = 1 ; i <= 1000000 ; i++){
                dp[i*2] |= dp[i];
                dp[i*3] |= dp[i];
                dp[i*5] |= dp[i];
        }
        for(int i = 1 ; i <= 1000000 ; i++){
                dp[i] += dp[i-1];
        }
        while(cin >> m && m){
                cin >> n;
                cout << dp[n] - dp[m-1] << endl;
        }
        return 0;
}

C++: #include<iostream>
#define D 100
using namespace std;
bool flg[D];
int ans[D];
int main(){
	
	int m,n;
	flg[1] = true;
	for(int i = 0;i <= D;i++){
		if(flg[i]){
			if(2*i<=D)flg[2*i] = true;
			if(3*i<=D)flg[3*i] = true;
			if(5*i<=D)flg[5*i] = true;
			//cout<<i<<endl;
		}
	}
	int cnt = 0;
	for(int i = 0;i <= D;i++){
		if(flg[i]) cnt++;
		ans[i] = cnt;
		//cout<<ans[i]<<endl;
	}
	while(cin>>m,m){
		cin>>n;
		cout<<ans[n] - ans[m-1]<<endl;
	}
	


}

C++: // 2011/06/22 Tazoe

#include <iostream>
using namespace std;

void hamming(bool is_hamming[], int n)
{
	for(int i=0; i<n; i++)
		is_hamming[i] = false;

	for(int i=1; i<n; i*=2)
		for(int j=i; j<n; j*=3)
			for(int k=j; k<n; k*=5)
				is_hamming[k] = true;
}

int main()
{
	bool is_hamming[1000001];
	hamming(is_hamming, 1000001);

	while(true){
		int m;
		cin >> m;
		if(m==0)
			break;
		int n;
		cin >> n;

		int cnt = 0;
		for(int i=m; i<=n; i++)
			if(is_hamming[i])
				cnt++;

		cout << cnt << endl;
	}

	return 0;
}

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

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

int main(){
  while(1){
    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;
  }
}

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<10;j++)
		{
			if(g%i==0){//cout<<g<<endl;
			c++;break;}
		else{g*=60;}
		}
		}
		cout<<c<<endl;
		
	}
	return 0;
}

C++: #include<stdio.h>



int main(){

long big=60*60*60*60;
int x,y;

while(1)
{
int c=0;
scanf("%d",&x);if(x==0)break;

scanf("%d",&y);

for(int i=x;i<=y;i++)
if(big%i==0)c++;

printf("%d\n",c);

}
return 0;
}

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

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;
const int N_MAX = 1000000;

int main()
{
	int res, st, ed;
	vector<bool> jud(N_MAX, false);
	jud[1] = true;

	for(int i = 1; i <= N_MAX/2; i++)
	{
		if(jud[i])
		{
			jud[i*2] = true;
			if(i*3 <= N_MAX)
			{
				jud[i*3] = true;
			}
			if(i*5 <= N_MAX)
			{
				jud[i*5] = true;
			}
		}
	}

	while(cin >> st, st)
	{
		cin >> ed;
		res = 0;
		for(int i = st; i <= ed; i++)
		{
			if(jud[i])
			{
				res++;
			}
		}
		cout << res << endl;
	}
}

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

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

const int N = 1000001;
int hamming[N];

int main() {
    rep(i, N) hamming[i] = true;

    hamming[0] = false;
    rep(i, N) {
        if(!hamming[i]) continue;
        if(i == 1 || i % 2 == 0 || i % 3 == 0 || i % 5 == 0) continue;

        for(int j = i * 1; j < N;j += i) {
            hamming[j] = false;
        }
    }

    //rep(i, 50) printf("%d %d\n", i, hamming[i]);

    while(1) {
        int m, n;
        cin >> m;
        if(!m) break;
        cin >> n;

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

    return 0;
}

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

int main() {
  int m, n;

  while(1) {
    cin << m << n;
    if(m == 0)
      break;

    int count = 0;
    for(int i = m; i <= n; i++) {
      if(i % 2 == 0)
        continue;
      else if(i % 3 == 0)
        continue;
      else if(i % 5 == 0)
        continue;
      else
        count++;
    }
    cout << count << endl;
  }
  return 0;
}

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

const int HAMMING_MAX = 1000001;

int main()
{
	bool hamming[ HAMMING_MAX ];
	memset( hamming, 0, sizeof(hamming) );

	for( int x = 1; x < HAMMING_MAX; x *= 2 ){
		for( int y = 1; x * y < HAMMING_MAX; y *= 3 ){
			for( int z = 1; x * y * z < HAMMING_MAX; z *= 5 ){
				int h = x * y * z;
				hamming[ h ] = true;
			}
		}
	}

	int n, m;
	while( cin >> n && n ){
		cin >> m;
		int count = 0;
		for( int i = n; i <= m; ++i ){
			if( hamming[ i ] ){
				++count;
			}
		}
		cout << count << endl;
	}

	return 0;
}