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

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

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++: #include <iostream>
#include <algorithm>

using namespace std;

bool prime[1000001];
int ans[1000001];

void erat()
{

    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i < 1000001; i++) {
        prime[i] = true;
    }

    for (int i = 2; i < 500001; i++) {
        if (prime[i]) {
            for (int j = 2; j*i < 1000001; j++) {
                prime[i*j] = false;
            }
        }
    }
}

void solve()
{
    ans[0] = 0;
    for (int i = 1; i < 1000001; i++) {
        ans[i] = 1;
    }
    for (int i = 7; i < 1000001; i++) {
        if (prime[i]) {
            for (int j = 2; i*j < 1000001; j++) {
                ans[i*j] = 0;
            }
            ans[i] = 0;
        }
    }
    for (int i = 1; i < 1000001; i++) {
        ans[i] += ans[i-1];
    }
}

int main() 
{
    int m, n;
    cin >> m;

    erat();
    solve();

    while (m) {
        cin >> n;
        cout << ans[n] - ans[m-1] << endl;
        cin >> m;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

int main() {
	int m, n;
	while (cin >> m, m) {
		cin >> n;
		int ans = 0;
		for (int i = 1; i <= n; i *= 2)
			for (int j = i; j <= n; j *= 3)
				for (int k = j; k <= n; k *= 5)
					if (k >= m) ans++;
		cout << ans << endl;
	}
	return 0;
}

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

#define NMAX 1000000

int main() {
  int h[NMAX+1];
  int n[] = {2,3,5};
  int a, b, t;
  memset(h, 0, sizeof(h));
  h[1] = 1;
  for (int i=0; i<3; i++) {
    for (int j=1; j<=NMAX; j++) {
      if (!h[j]) continue;
      t = j * n[i];
      if (t <= NMAX) {
        h[t] = 1;
      }
    }
  }
  for (int i=1; i<NMAX; i++) {
    h[i] += h[i-1];
  }
  while (1) {
    cin >> a;
    if (!a) break;
    cin >> b;
    cout << h[b]-h[a-1] << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-10
#define PB push_back
#define fi first
#define se second
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<int,int> Pii;
typedef vector<int> vi;
int ans[1000001];
ll mod_pow(ll x, ll n ,ll mod){
	if(n == 0) return 1;
	ll res = mod_pow(x*x%mod,n/2,mod);
	if(n & 1) res = res * x % mod;
	return res;
}
void makeHammingNumbers(){
	rep(i,1000000){
		rep(j,7){
			if(mod_pow(60,j,i+1)==0){
				ans[i+1] = 1;
				break;
			}
		}
	}
	return ;
}
int main(){
	makeHammingNumbers();
	reps(i,1,1000000){
		ans[i+1] += ans[i];
	}
	int m;
	while(scanf("%d",&m),m){
		int n;
		scanf("%d",&n);
		printf("%d\n",ans[n]-ans[m-1]);
	}
	return 0;
}

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

#define MAX 1000000

int main()
{
	int i, j, k;
	int a, b;
	vector<int> h(MAX+1);
	for (i = 1; i <= MAX; i *= 2) {
		h[i] = 1;
		for (j = 1; i*j <= MAX; j *= 3) {
			h[i*j] = 1;
			for (k = 5; i*j*k <= MAX; k *= 5) {
				h[i*j*k] = 1;
			}
		}
	}

	while (cin>>a>>b, a) {
		k = 0;
		for (i = a; i <= b; i++)
			if (h[i]) k++;
		cout<<k<<endl;
	}
	return 0;
}

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

int main() {

  int n,m;

  while(1) {

    cin >> n;
    if(n == 0) break;

    cin >> m;
    int t;
    int count = 0;
    for(int i=n;i<=m;i++) {
      t = i;

      while(1) {
	//	cout << "t = " << t<< endl;
      if(t%2 == 0)t /= 2;
      else if(t%3 ==0)t /= 3;
      else if(t%5 ==0) t /= 5;
      else break;
      }

      if(t == 1) count++;
    }

    cout << count << endl;

  }

  return 0;

}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){

  int m,n;

  while(1){

	cin>>m;

	if(m==0)
	  break;

	cin>>n;
	
	int count = 0;
	
	for(int i=m;i<=n;++i){

	  int result = i;
	  
	  while(1){

		if(result%2==0)
		  result = result/2;
		else if(result%3==0)
		  result = result/3;
		else if(result%5==0)
		  result = result/5;
		else
		  break;
	  }
	  
	  if(result == 1)
		count++;
	  
	}

	cout<<count<<endl;
	
  }
  
}

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

using namespace std;

vector<int> ham;

void makeHamList(){
	for(int i = 0; i <= 21; i++){
		for(int j = 0; j <=11; j++){
			for(int k = 0; k <= 9; k++){
				int sum=(int)pow(2.0,i)*(int)pow(3.0,j)*(int)pow(5.0,k);
				if(sum<=1000000)
					ham.push_back(sum);
			}
		}
	}
}

int main(){

	int m,n;
	makeHamList();
	while(cin>>m&&m!=0){
		cin>>n;
		int cnt=0;
		for(int i = 0; i < ham.size(); i++){
			if(ham[i]>=m&&ham[i]<=n)
				cnt++;
		}
		cout<<cnt<<endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int m,n;
    while (cin>>m>>n) {
        if (m==0) {
            break;
        } else {
            int count=0;
            for (int i=m;i<=n;i++) {
                int tmp=i;
                if (tmp%2==0) {
                    while (tmp%2==0) {
                        tmp=tmp/2;
                    }
                    while (tmp%3==0) {
                        tmp=tmp/3;
                    }
                    while (tmp%5==0) {
                        tmp=tmp/5;
                    }
                    if (tmp==1) {
                        count++;
                    }
                } else {
                    while (tmp%3==0) {
                        tmp=tmp/3;
                    }
                    while (tmp%5==0) {
                        tmp=tmp/5;
                    }
                    if (tmp==1) {
                        count++;
                    }
                }
            }
            cout<<count<<endl;
        }
    }
}

C++: #include <iostream>
using namespace std;
int main( void )
{
	int n, m;
	while ( cin >> m >> n )
	{
		int answer = 0;
		for ( int i = m; i <= n; i++ )
		{
			int h = i;
			while ( h % 2 == 0 ) h /= 2;
			while ( h % 3 == 0 ) h /= 3;
			while ( h % 5 == 0 ) h /= 5;
			if ( h == 1 ) answer++;
		}
		cout << answer << endl;
	}
	return 0;
}