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 <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

const long N=1000000;

int main(){
    long ham[550];
    long now=0;
    
    for(int i=0; i<20; ++i){
        for(int j=0; j<13; ++j){
            for(int k=0; k<9; ++k){
                long t=pow(2,i)*pow(3,j)*pow(5,k);
                if(t>N) break;
                ham[now++]=t;
            }
        }
    }
    
    sort(ham, ham+now);
    
    while(1){
        long a, b, ans=0;
        scanf(" %ld", &a);
        if(a==0) break;
        scanf(" %ld", &b);
        
        for(long i=0; i<N; ++i){
            if(ham[i]>=a){
                now=i;
                break;
            }
        }
        
        for(long i=a; i<=b; ++i){
            if(ham[now]==i){
                ++ans;
                ++now;
            }
        }
        
        printf("%ld\n", ans);
    }
    
    return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;
#define N_MAX 1000000

int main()
{
	int res, st, ed;
	vector<bool> jud(N_MAX, false);
	jud[1] = true;

	for(int i = 1; i <= N_MAX/2; i++)
	{
		if(jud[i])
		{
			jud[i*2] = true;
			jud[i*3] = true;
			jud[i*5] = true;
		}
	}

	while(cin >> st, st)
	{
		cin >> ed;
		res = 0;
		for(int i = st; i <= ed; i++)
		{
			if(jud[i])
			{
				res++;
			}
		}
		cout << res << endl;
	}
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    bool latte[1000001];
    fill(latte,latte+1000001,false);
    latte[1]=true;
    for(int i=1;i<=1000000;i++){
         if(!latte[i])continue;
         if(i*2<=1000000)latte[i*2]=true;
         if(i*3<=1000000)latte[i*3]=true;
         if(i*5<=1000000)latte[i*5]=true;
    }
    int m;
    while(cin>>m,m){
        int n;
        cin>>n;
        int cnt=0;
        for(int i=m;i<=n;i++)if(latte[i])cnt++;
        cout<<cnt<<endl;
    }
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;

bool a[1000010];
int b[1000010]={0};

int main(){
	for(ll i=0;i<1000010;i++){
		a[i]=false;
	}
	a[1]=true;
	for(ll i=1;i<1000010;i++){
		if(a[i]){
			if(2*i<1000010) a[2*i]=true;
			if(3*i<1000010) a[3*i]=true;
			if(5*i<1000010) a[5*i]=true;
		}
	}
	/*
	rep(i,100){
		if(a[i]){
			cout<<i<<" ";
		}
	}
	cout<<endl;
	*/
	for(ll i=1;i<1000010;i++){
		//if(i==0) continue;
		b[i]=b[i-1];
		if(a[i]) b[i]++;
	}
	ll m,n;
	while(cin>>m,m){
		cin>>n;
		if(a[m]) cout<<b[n]-b[m]+1<<endl;
		else cout<<b[n]-b[m]<<endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int judge(int x){
  int tmp = 0;

  while(x != 1){
    if(x % 2 == 0) x /= 2;
    if(x % 3 == 0) x /= 3;
    if(x % 5 == 0) x /= 5;
    if(tmp == x) return 0;
    tmp = x;
  }
  return 1;
}

int main(){

  int fir, end;

  while(cin >> fir >> end){
    int sum = 0;
    for(int i = fir; i <= end; i++){
      if(judge(i)) sum++;
    }

    cout << sum << endl;
  }

  return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;
/** Problem0162 : Hamming Numbers **/
int main()
{
	set<int> h;

	rep(i, 20) {
		rep(j, 20) {
			rep(k, 20) {
				h.insert(pow(2.0, i)*pow(3.0, j)*pow(5.0,k));
			}
		}
	}
	
	int m, n, ans;
	while (cin>>m>>n, m) {
		ans=0;
		set<int>::iterator it = h.begin();
		for (; it!=h.end(); it++) {
			if (m<=*it && *it<=n) {
				ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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 h[1000001];
int main(){
    h[1]=1;
    for(int i=2;i<=1000000;i*=2)h[i]=1;
    for(int 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(int i=1;i<=1000000;i++){
        if(h[i]){
            for(int j=i*5;j<=1000000;j*=5)if(h[j]==0)h[j]=3;
        }
    }
    int a,b;
    while(scanf("%d",&a),a){
        scanf("%d",&b);
        int ret=0;
        for(int i=a;i<=b;i++)if(h[i])ret++;
        printf("%d\n",ret);
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int cnt[1000001];
int main() {
	for (int i = 1; i <= 1000000; i++) {
		cnt[i] = cnt[i - 1];
		if (!(604661760000000000LL % (ll)i))cnt[i]++;
	}
	int m, n;
	while (scanf("%d", &m), m) {
		scanf("%d", &n);
		printf("%d\n", cnt[n] - cnt[m - 1]);
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int M=1000001;
  bool d[M];
  memset(d,false,sizeof(d));
  d[1]=true;
  rep(i,M) {
    if(d[i]) {
      if(i*2<M) d[i*2]=true;
      if(i*3<M) d[i*3]=true;
      if(i*5<M) d[i*5]=true;
    }
  }
  int n,m;
  while(cin >> n && n) {
    cin >> m;
    int ans=0;
    REP(i,n,m+1) ans+=d[i];
    pr(ans);
  }
  return 0;
}