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>
using namespace std;
int main(){
long n,m,i,j,h[500000],j2,j3,j5,x2,x3,x5,f;
while(cin>>m){
if(m==0)break;
cin>>n;
j2=j3=j5=0;
x2=x3=x5=1;
f=0;
for(i=0;;i++){
h[i]=min(min(x2,x3),x5);
if(f==0&&h[i]>=m){j=i;f=1;}
if(h[i]>n)break;
while(x2<=h[i])x2=2*h[j2++];
while(x3<=h[i])x3=3*h[j3++];
while(x5<=h[i])x5=5*h[j5++];
}
cout<<i-j<<endl;
}
return 0;
}

C++: #include<iostream>
using namespace std;
const int MAX_N=1001000;
bool table[MAX_N];

int main(){
	int n,m;
		for(int i=0;i<MAX_N;i++)table[i]=false;
		
		table[1]=table[2]=table[3]=table[5]=true;
		for(int i=2;i<MAX_N;i++){
		
		if(table[i]){
		if(i*2<MAX_N)table[i*2]=true;
		if(i*3<MAX_N)table[i*3]=true;
		if(i*5<MAX_N)table[i*5]=true;
		}
	}
	
	while(cin>>n>>m,n&&m){
		int ans=0;
		for(int i=n;i<=m;i++){
			if(table[i]){
			ans++;
			}
		}
		cout<<ans<<endl;
	}
	

	

	
	return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int INF=1000000;
char fi[101][101];
int d[21][21];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;

int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003

int dp[353][353]={0};
int bow[353][353]={0};


int main(){
	
	vector<int> p(1000100);
	
	p[1]=1;
	p[2]=1;
	p[3]=1;
	p[4]=1;
	p[5]=1;
	for(ll i=6;i<=1000000;i++){
		if(i%2==0&&p[i/2]||i%3==0&&p[i/3]||i%5==0&&p[i/5])
			p[i]=1;
	}
	
	int m,n;
	
	while(cin>>m,m!=0){
		cin>>n;
		ll count=0;
		for(int i=m;i<=n;i++)
			count+=p[i];
		cout<<count<<endl;
	}
	
	
	

	
}

C++: #include<iostream>
#include<set>
#include<string>
using namespace std;
int main() {
	set<long long>a;
	long long b, c,sum = 1;
	for (int i = 0; i <= 19; i++) {
		b = sum;
		for (int j = 0; j <= 12; j++) {
			c = sum;
			if (sum > 1000000)
				break;
			for (int z = 0; z <= 8; z++) {
				a.insert(sum);
				if (sum > 1000000)
					break;
				sum *= 5;
			}
			sum = c;
			sum *= 3;
		}
		sum = b;
		sum *= 2;
	}
	int m, n,o=0;
	string d, h = "";
	while (getline(cin, d)) {
		o = 0;
		if (d.length() == 1) break;
		d += " ";
		h = "";
		for (int i = 0; i < d.length(); i++) {
			if (d[i] == ' ') {
				if (o == 0){ m = atoi(h.c_str());}
				else {n = atoi(h.c_str());}
				o++;
				h = "";
			}
			else
				h += d[i];
		}
		set<long long>::iterator it = a.begin();
		int sum = 0;
		while ((*it) < m) {
			it++;
			if (it == a.end()){ break;}
		}
		while ((*it) >= m && (*it) <= n)
		{
			it++;
			sum++;
			if (it == a.end()) {break;}
		}
		cout << sum << endl;
	}
}

C++: #include<stdio.h>

int main(){

int x,y,c=0;
bool f[1000001];
for(int i=0;i<=1000001;i++)
	f[i]=false;
for(int i=0;i<=1000001;i++)
{
if(i%2==0)f[i]=true;
else if(i%3==0)f[i]=true;
else if(i%5==0)f[i]=true;
}

while(scanf("%d %d",&x,&y))
{
	for(int i=x;i<=y;i++)
{if(bool[i]==true)c++;
	}
	
	
	/*
for(int i=x;i<=y;i++)
{
if(i%2==0)c++;
else if(i%3==0)c++;
else if(i%5==0)c++;
}
*/
printf("%d\n",c);c=0;
}
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


const int MAX = 1e6;
int dp[MAX+1], s[3] = {2, 3, 5};
signed main(){
  dp[1] = 1;
  repi(i,2,MAX+1){
    rep(j,3)if(i%s[j] == 0){
      chmax(dp[i], dp[i/s[j]]);
    }
  }
  rrep(i,MAX)dp[i] += dp[i-1];
  while(1){
    int l, r;
    scanf("%lld", &l);
    if(l == 0)break;
    scanf("%lld", &r);
    printf("%lld\n", dp[r]-dp[l-1]);
  }
	return 0;
}

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

#define MAX 1000000

int num[MAX];

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

	for (int i = 1; i <= MAX; i++){
		num[i] += num[i - 1];
	}

	int m, n;

	while (scanf("%d", &m), m){
		scanf("%d", &n);
		printf("%d\n", num[n] - num[m - 1]);
	}

	return (0);
}

C++: #include<bits/stdc++.h>
using namespace std;

bool check(int n){
  while(n%2==0){
    n/=2;
  }
  while(n%3==0){
    n/=3;
  }
  while(n%5==0){
    n/=5;
  }
  if(n==1){
    return true;
  }else{
    return false;
  }
}

int main(){
  int m,n;
  while(1){
    cin>>m;
    if(m==0)break;
    cin>>n;
    int ans=0;
    for(int i=m;i<=n;i++){
      if( check(i) ){
        ans++;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}