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++: 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#define strtok_r strtok_s
#endif

#define ITER(c)             __typeof__((c).begin())
#define FOREACH(it, c)      for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)            __typeof__((c).rbegin())
#define RFOREACH(it, c)     for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)           REPEAT(i, 0, n)
#define RREP(i, n)          RREPEAT(i, 0, n)
#define REPEAT(i, k, n)     for(int i = (k); i < ((k)+(n)); ++i)
#define RREPEAT(i, k, n)    for(int i = (k)+(n)-1; i >= (k); --i)
#define FROMTO(i,f,t)       for(int i = f; i < t; i++)
#define ALL(c)              (c).begin(), (c).end()
#define LLPOW(p1,p2)        ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)          (sizeof(A)/sizeof((A)[0]))
#define CIN_NO_SYNC         do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)           fgets((p), sizeof(p), stdin)
#define CHOMP(p)            do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define FILL(m,v)           memset(m, v, sizeof(m))
#define mp                  make_pair
#define pb                  push_back
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;} 
template <class _Tv> inline string join(const _Tv &v,string sep=" "){
    ostringstream s;FOREACH(it,v){if(it!=v.begin())s<<sep;s<<*it;};return s.str();
}

typedef long long ll;
typedef unsigned long long ull;
typedef double D;
typedef complex<D> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define X real()
#define Y imag()
#define EPS (1e-9)
#define DEQ(p1,p2) (abs((p1)-(p2)) < EPS)

#ifdef _DEBUG
template<class _Tv> inline void _prfe(const char *_n,const _Tv _c,bool _p=false){
    ITER(_c) _it=_c.begin();
    if(_p){cout<<_n<<" = ["<<endl;for(;_it!=_c.end();++_it)cout<<"    "<<*_it<<endl;cout<<"]"<<endl; }
    else{cout<<_n<<" = [ "<<*_it++;for(;_it!=_c.end();++_it)cout<<", "<<*_it;cout<<" ]"<<endl; }
}
ostream &operator<<(ostream &os, const pair<int,int> &p){return(os<<"("<<p.first<<","<<p.second<<")");}
#define pf printf
#define pr(n) do{cout<<#n" = "<<(n)<<endl;}while(0)
#define prfe(n) _prfe(#n, n)
#define prfep(n) _prfe(#n, n, true)
#define dbgchk(n) do{if(n)throw;}while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#define prfe(...) /* */
#define prfep(...) /* */
#define dbgchk(...) /* */
#endif

int a[1000001];

int main(){
    int m,n;
    a[1] = 1;
    FROMTO(i,1,1000001){
        if(a[i]){
            if(i*2 < 1000001) a[i*2] = 1;
            if(i*3 < 1000001) a[i*3] = 1;
            if(i*5 < 1000001) a[i*5] = 1;
        }
        a[i] += a[i-1];
    }
    while(cin >> m >> n && m && n){
        cout << a[n]-a[m-1] << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n, m;
  constexpr int max_n = 1e6+1;
  vector<int> H = {1};
  int p[] = {2,3,5};
  for(int i = 0; i < 3; ++i){
    int s = H.size();
    for(int k = 0; k < s; ++k){
      int h = H[k];
      while(h*p[i] < max_n){
        h *= p[i];
        H.push_back(h);
      }
    }
  }
  sort(H.begin(),H.end());
  // for(auto h : H){
  //   cerr << h << " ";
  // }
  // cerr << endl;
  while(cin >> m, m){
    cin >> n;
    int a = upper_bound(H.begin(),H.end(),n) - lower_bound(H.begin(),H.end(),m);
    cout << a << endl;
  }
}

C++: #include<iostream>

bool ham[1000001];
int cnt[1000001];

int main()
{
	ham[1] = true;

	for( int i = 0; i <= 1000000; ++i )
	{
		if( ( i % 2 == 0 && ham[i/2] ) || ( i % 3 == 0 && ham[i/3] ) || ( i % 5 == 0 && ham[i/5] ) )
			ham[i] = true;

		cnt[i] = cnt[i-1] + ham[i];
	}

	int m, n;
	while( std::cin >> m, m )
	{
		std::cin >> n;

		std::cout << cnt[n] - cnt[m] + 1 << std::endl;
	}

	return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define N 1000001
using namespace std;

int main(){
	bool hamming[N]={false};
	hamming[1] = true;
	for(int j=2;j<N;j++){
		int i=j;
		while(i%2==0) i /= 2;
		while(i%3==0) i /= 3;
		while(i%5==0) i /= 5;
		if(i==1) hamming[j] = true;
	}

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

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

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 100 * 1000 + 10;

bool ham[MAXN];

int main()
{
    ham[1] = 1;
    REP(MAXN)if(ham[i])
    {
        for(int j=i*2; j<MAXN;j*=2)ham[j] = 1;
        for(int j=i*3; j<MAXN;j*=3)ham[j] = 1;
        for(int j=i*5; j<MAXN;j*=5)ham[j] = 1;
    }
    int m, n;
    while(cin >> m && m)
    {
        cin >> n;
        int ans = 0;
        for(int i = m;i<=n;i++)if(ham[i])ans++;
        cout << ans << endl;
    }

    return 0;
}

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

using namespace std;

const int MAX = 1000000;

int dp[MAX + 1] = {};

void check(int a, int b, int c) {
  int mul = 1;
  for (int i = 0; i < a; i++) {
    mul *= 2;
    if (mul > MAX) return;
  }
  for (int i = 0; i < b; i++) {
    mul *= 3;
    if (mul > MAX) return;
  }
  for (int i = 0; i < c; i++) {
    mul *= 5;
    if (mul > MAX) return;
  }
  dp[mul] = 1;
}

int main(void) {
  int m, n;

  for (int i = 0; i < 20; i++) {
    for (int j = 0; j < 13; j++) {
      for (int k = 0; k < 9; k++) {
        check(i, j, k);
      }
    }
  }
  for (int i = 1; i <= MAX; i++) {
    dp[i] += dp[i - 1];
  }

  while (cin >> m, m) {
    cin >> n;
    cout << dp[n] - dp[m - 1] << endl;
  }

  return 0;
}