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"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

ll powermod(ll a,ll b,ll m){
	if(b==0){
		return 1LL;
	}
	if(b%2){
		return (a*powermod(a,b-1LL,m))%m;
	}
	return powermod((a*a)%m,b/2LL,m);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int K[3]={0,0,0};
	int P[3]={2,3,5};
	REP(i,3){
		int V=1000000;
		while(V){
			K[i]++;
			V /= P[i];
		}
	}
	vector<ll> H(1000001,0),S(1000002,0);
	for(int i=0;i<=K[0];i++){
		for(int j=0;j<=K[1];j++){
			for(int k=0;k<=K[2];k++){
				auto V = 1LL*powermod(2,i,atcoder_mod)*powermod(3,j,atcoder_mod)*powermod(5,k,atcoder_mod);
				if(V<=1000000LL){
					H[V]=1;
				}
			}
		}
	}
	for(int i=0;i<1000001;i++){
		S[i+1]=S[i]+H[i];
	}

	while(true){
		ll N=in();
		if(!N) break;

		ll M=in();

		out(S[M+1]-S[N]);
	}
	
	return 0;
}

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

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int,in,){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, int &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=(char)c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);} _OUT(const char *s){while(*s)pcu(*s++);} _OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{
	int e,b=0,s=1; range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it { int v, s; it (int _v, int _s) : v(_v), s(_s) {} operator int()const{return v;} operator int&(){return v;} int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin() {return {b, s};} it end() {return {e, s};}};

#define all(o) begin(o), end(o)

int main() {
	const int N {1000000};
	vector<int> v;
	for (int i = 1; i <= N; i *= 2)
		for (int j = 1; i * j <= N; j *= 3)
			for (int k = 1; i * j * k <= N; k *= 5)
				v.push_back(i * j * k);
	sort(all(v));
	for (int m; (m = in());)
		outl((int) (upper_bound(all(v), in()) - lower_bound(all(v), m)));
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
   int h[1000001];
   int i,n,m;
   h[1]=1;
   for(i=2;i<=1000000;i*=2)h[i]=1;
   for(i=1;i<=1000000;i++){
       if(h[i]){
           for(int j=i*3;j<=1000000;j*=3){
               if(h[j]==0)h[j]=2;
           }
       }
   }
   for(i=1;i<=1000000;i++){
       if(h[i]){
           for(int j=i*5;j<=1000000;j*=5){
               if(h[j]==0)h[j]=3;
           }
       }
   }
   while(cin>>n&&n){
       cin>>m;
       int count=0;
       for(i=n;i<=m;i++){
           if(h[i]) count++;
       }
       cout<<count<<endl;
   }
}

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

bool ham[100001];
int m,n;

void solve(){
	for(int i=1; i<6; i++)
		ham[i] = true;
	for(int i=6; i<100001; i++)
		ham[i] = false;
	for(int i=2; i<100001; i++){
		if(ham[i]){
			for(int j=i*2; j<size; j*=2){
				if(j>100001)
					break;
				ham[j] = true;
			}for(int j=i*3; j<size; j*=3){
				if(j>100001)
					break;
				ham[j] = true;
			}for(int j=i*5; ; j*=5){
				if(j>100001)
					break;
				ham[j] = true;
			}
		}
	}
}

int main(){
	solve();
	while(true){
		cin >> m >> n;
		if(!m && !n)
			return 0;
		int ans = 0;
		for(int i=m; i<=n; i++)
			if(ham[i])
				ans++;
		cout << ans << endl;
	}
}

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

vector<int> hamming;

void ham() {
  int temp;
  for(int i=0;i<20;i++) {
    for(int j=0;j<20;j++) {
      for(int k=0;k<20;k++) {
        temp = pow(2.0,(double)i)*pow(3.0,(double)j)*pow(5.0,(double)k);
        if(temp <= 1000000 && temp >= 0) {
        hamming.push_back(temp);
        cout << temp << endl;
        }
        else {
          break;
        }
      }
    }
  }
}

int main() {
  int m,n,from,to;
  vector<int>::iterator low,up;
  ham();
  sort(hamming.begin(),hamming.end());
  while(cin >> m >> n) {
    low=lower_bound(hamming.begin(), hamming.end(), m);
    up=upper_bound(hamming.begin(),hamming.end(),n);
    from = int(low-hamming.begin());
    to = int(up-hamming.begin());
    cout << to-from << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int array[1000001];
	array[1]=1;
	for(int i=2;i<=1000000;i++){
		int k=i;
		bool f=false;
		while(1){
			if(k%2==0)k/=2;
			else if(k%3==0)k/=3;
			else if(k%5==0)k/=5;
			else break;
			if(k==1){
				f=true;break;
			}
		}
		if(f)array[i]=array[i-1]+1;
		else array[i]=array[i-1];
	}
	int a,b;
	while(cin>>a>>b,a){
		cout<<array[b]-array[a-1]<<endl;
	}
}

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

const int MAX = 1000001;
char p[MAX] = {};
inline void foo(int n){
	if( n >= MAX || p[n] ) return;
	p[n] = 1;
	foo(n*2);
	foo(n*3);
	foo(n*5);
}

int main(){
	int n,m;
	foo(1);

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