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;
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<11;j++){
                    if(kawa%i==0){
                        co++;
                        break;
                    }
                    kawa*=60;
                }
            }
        }
        cout<<co<<endl;
    }
}

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

using namespace std;

bool prime[10000];

void erat()
{

    for (int i = 2; i < 10000; i++) {
        prime[i] = true;
    }

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

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

    erat();

    while (m) {
        cin >> n;
        int count = 0;

        for (int i = m; i < n+1; i++) {
            bool fl = true;
            for (int j = 7; j*j <= i; j++) {
                if (prime[j] && !(i % j)) {
                    fl = false;
                    break;
                }
            }
            if (fl) {
                count++;
            }
        }
        cout << count << endl;
        cin >> m;
    }
    return 0;
}

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

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

int solve_testcase() {
    int L; scanf("%d", &L);
    if(L == 0) return 1;
    int R; scanf("%d", &R);

    int ans = 0;
    for(int i=L; i<=R; i++) ans += is_valid(i);
    printf("%d\n", ans);
    
    return 0;
}

int main() {
    while(!solve_testcase());
}

C++: #include<complex>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<vector>
#include<map>
#include<sstream>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<deque>
#include<queue>
#include<climits>
#include<list>
#include<stack>
#include<ctime>
#define all(n) n.begin(),n.end()
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define S second
#define Iter(c) __typeof__((c).begin())
#define foreach(i,c) for(Iter(c) i = (c).begin();i != (c).end();++i)
#define pb push_back
#define INF (1<<27)
#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)

using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef unsigned long long ull;
typedef long long ll;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};


int main(){
  int m,n;

  while(true)
    {
      cin >> m;
      if(!m)break;
      cin >> n;
      int cnt = 0;
      for(int i=1;i<=n;i*=2)
	{
	  for(int j=1;i*j<=n;j*=3)
	    {
	      for(int k=1;k*i*j<=n;k*=5)
		{
		  if(i*j*k >= m)
		    cnt++;
		}
	    }
	}
      cout << cnt << endl;
    }

return 0;
}

C++: #include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
const int MX = 1000000;
int main(){
	bool h[MX+1] = {};
	h[1] = h[2] = h[3] = h[5] = 1;
	rep2(i,2,MX+1) {
		if(h[i]) {
			if(i*2 <= MX) h[i*2] = 1;
			if(i*3 <= MX) h[i*3] = 1;
			if(i*5 <= MX) h[i*5] = 1;
		}
	}
    int m, n;
	while(cin >> m, m) {
		cin >> n;
		int cnt = 0;
		rep2(i,m,n+1) {
			if(h[i]) cnt++;
		}
		cout << cnt << endl;
	}
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int m,n;

int main(){
	while(cin>>m>>n){
		int ans=0;
		for(int i=0;i<20;i++)for(int j=0;j<20;j++){
			for(int k=0;k<20;k++){
				int h=pow(2,i)*pow(3,j)*pow(5,k);
				if(h>=m&&h<=n)ans++;
				if(h>1e+6)break;
			}
			if(pow(2,i)*pow(3,j)>1e+6)break;
		}
		cout<<ans<<endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

//a^n
LL Pow(LL a, LL n) {
	LL ans = 1;
	while (n > 0) {
		if (n & 1)ans *= a;
		a *= a;
		n >>= 1;
	}
	return ans;
}

VL Hamming() {
	VL ret;
	rep(i2, 21) {
		rep(i3, 14) {
			rep(i5, 10) {
				LL x = Pow(2, i2)*Pow(3, i3)*Pow(5, i5);
				if (x <= 1000000)ret.pb(x);
			}
		}
	}
	sort(all(ret));
	return ret;
}


int main() {
	VL hu = Hamming();

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

		LL ans = 0;
		for (auto aa : hu) {
			if (m <= aa && aa <= n)ans++;
		}
		Cout(ans);
	}
}

/*
2^20 > 10^6
3^13 > 10^6
5^9  > 10^6
*/

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

		int d=1;
		for(int i=0;i<A;i++)
			for(int j=0;j<A;j++){
			if(n[i][j][3]<d)
		
		*/
	}
	return 0;
}

C++: // 2015/05/19 Tazoe

#include <iostream>
using namespace std;

int main()
{
	bool is_hamming[1000001];	// ハミング数かどうかのテーブル

	for(int i=0; i<1000001; i++){
		is_hamming[i] = false;
	}

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

	int n_hamming[1000001];		// ハミング数の個数のテーブル

	int cnt = 0;
	for(int i=0; i<1000001; i++){
		if(is_hamming[i]){
			cnt++;
		}
		n_hamming[i] = cnt;
	}

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

		if(m==0)
			break;

		int n;
		cin >> n;

		cout << n_hamming[n]-n_hamming[m-1] << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
bool is_hamming(int n){
	
}
int main(){
	while(1){
		int num=0,num1,num2;
		cin>>num1;
		if(num1==0)
			return 0;
		cin>>num2;
		for(int i=num2;num1<=i;i--){
			int j=i;
			while(j%5==0)
				j=j/5;
			while(j%3==0)
				j=j/3;
			while(j%2==0)
				j=j/2;
			if(j==1)
				++num;
			
		}
		cout<<num<<endl;
	}
	return 0;
}