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<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 (60 * 60 * 60 * 60 % i == 0){
				sum++;
			}
		}
		l.push_back(sum);
	}
	for (long long i : l) {
		cout << i << endl;
	}
	char c;
	cin >> c;
}

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    vector<int> ans;
    int v[3] = {2, 3, 5};
    auto f = [&](int val, int cur, auto &&f){
        if(val > 1000000) return;
        ans.emplace_back(val);
        f(val*v[cur], cur, f);
        if(cur != 2) f(val, cur+1, f);
    };
    f(1, 0, f);
    sort(ans.begin(), ans.end());
    ans.erase(unique(ans.begin(), ans.end()), ans.end());
    int l;
    while(cin >> l, l){
        int r;
        cin >> r;
        cout << upper_bound(ans.begin(),ans.end(), r) - lower_bound(ans.begin(),ans.end(), l) << "\n";
    }
    return 0;
}

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

bool is_hamming[1000001];

int pow(int a,int b){
	int result=1;
	for(int i=0; i<b; ++i){
		result*=a;
	}
	return result;
}

void calc(){
	fill(is_hamming,is_hamming+1000001,false);
	for(int i=0; i<21 ; ++i){
		bool flag=true;
		for(int j=0; j<14 ; ++j){
			for(int k=0; k<10 ; ++k){
				unsigned long long int tmp=pow(2,i)*pow(3,j)*pow(5,k);
				//cout << tmp << endl;
				if(tmp>1000000) break;
				is_hamming[tmp]=true;
			}
		}
	}
}

int main(){
	int M,N;
	calc();
	while(cin >> M&&M){
		cin >> N;
		int ans=0;
		for(int i=M; i<=N; ++i) if(is_hamming[i]) ++ans;
		cout << ans << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int m, n;
	vector<int>v(1000001, 1);
	v[0] = v[1] = 0;
	for (int i = 2; i <= sqrt(1000000); i++) {
		if (v[i]) {
			for (int j = 0; i*(j+2) <= 1000000; j++) {
				v[i*(j+2)] = 0;
			}
		}
	}
	//for (int i = 2; i < 100; i++) {
	//	if (v[i])printf("%4d", i);
	//}
	//cout << endl;

	while (cin >> m >> n, m) {
		int cnt = 0;
		for (int i = m; i <= n; i++) {
			if (i == 1)cnt++;
			bool f = false;
			bool g = false;
			if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) {
				g = true;
			}
			for (int j = 7; j < i; j++) {
				if (v[j] && i%j == 0) {
					f = true;
					break;
				}
			}
			if (!f&&g)cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int a[1000001]={0};
int main(void){
  a[1]=1;
  for(int i=1;i<=1000000;i++){
    if(a[i] && i*2<=1000000) a[i*2]=1;
    if(a[i] && i*3<=1000000) a[i*3]=1;
    if(a[i] && i*5<=1000000) a[i*5]=1;
  }
  int n,m;
  while(cin >> n,n){
    cin >> m;
    int c=0;
    for(int i=n;i<=m;i++){
      if(a[i]) c++;
    }
    cout << c << endl;
  }
}

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

int main(){
  bool data[1000001];
  int n,m,k,count;

  for(int i = 0;i < 1000001;i++){
    k = i;
    while(k%2 == 0&&k >=2)k /= 2;
    while(k%3 == 0&&k >=3)k /= 3;
    while(k%5 == 0&& k >= 5)k /= 5;
    if( k == 1)
      data[i] = true;
    else
      data[i] = false;
  }

  while(1){
    cin >> m;
    if(m == 0)break;
    cin >> n;
    count = 0;
    for(int i = m; i <= n;i++)
      if(data[i] == true)count++;

    cout << count << endl;
    }
  return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

int dp[1000001];
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	memset(dp, false, sizeof(dp));
	dp[1] = true;
	vector<int>ns{ 2,3,5 };
	for (int i = 1; i <= 1000000; ++i) {
		if (dp[i]) {
			for (int j = 0; j < 3; ++j) {
				if (i*ns[j] <= 1000000) {
					dp[i*ns[j]] = true;
				}
			}
		}
		
	}
	while (1) {
		int M; cin >> M;
		if (!M)break;
		int N; cin >> N;
		int ans = 0;
		for (int i = M; i <= N; ++i) {
			if (dp[i])ans++;
		}
		cout << ans << endl;

	}
	
	return 0;
}

C++: // 2011/02/12 Tazoe

#include <iostream>
using namespace std;

int main()
{
	bool ham[1000001];
	for(int i=0; i<=1000000; i++)
		ham[i] = false;

	for(int i=1; i<=1000000; i*=2)
		for(int j=i; j<=1000000; j*=3)
			for(int k=j; k<=1000000; k*=5)
				ham[k] = true;

	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(ham[i])
				cnt++;

		cout << cnt << endl;
	}

	return 0;
}

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

int main(void){
  bool ishammingNumber[1000001] = {false, true, true, true, true, true};
  for(int i = 6; i <= 1000000; i++){
    if((i % 2 == 0 && ishammingNumber[i/2]) || (i % 3 == 0 && ishammingNumber[i/3]) || (i % 5 == 0 && ishammingNumber[i/5])) ishammingNumber[i] = true;
    else ishammingNumber[i] = false;
  }
  int m, n, cnt;
  while(cin >> m && m != 0 && cin >> n){
    cnt = 0;
    for(int i = m; i <= n; i++) if(ishammingNumber[i]) cnt++;
    cout << cnt << endl;
  }
  return 0;
}

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

int main() {
  int m, n;
  int num;

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

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

C++: #include <stdio.h>
#include <iostream>

using namespace std;

bool check (int a)
{
	while (a % 2 == 0) {
		a /= 2;
	}

	while (a % 3 == 0) {
		a /= 3;
	}

	while (a % 5 == 0) {
		a /= 5;
	}

	if (a == 1) {
		return true;
	} else {
		return false;
	}

}

int main() {
	int m,n;
	int counter;

	while (cin >> m) {
		if (m == 0) {
			break;
		}
		else {
			cin >> n;
			counter = 0;
			for (int i = m; i <= n; i++) {
				if (check(i)) {
					counter++;
				}
			}
			cout << counter << endl;
		}
	}
	return 0;
}