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 <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int MAX = 1000000;
    vector<int> hamming(MAX+1, 0);
    hamming[1] = -1;
    for(int i=1; i<=MAX; ++i){
        if(hamming[i] == -1){
            if(i * 2 <= MAX)
                hamming[i*2] = -1;
            if(i * 3 <= MAX)
                hamming[i*3] = -1;
            if(i * 5 <= MAX)
                hamming[i*5] = -1;
            hamming[i] = hamming[i-1] + 1;
        }else{
            hamming[i] = hamming[i-1];
        }
    }

    for(;;){
        int m, n;
        cin >> m >> n;
        if(m == 0)
            return 0;

        cout << (hamming[n] - hamming[m-1]) << endl;
    }
}

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++){
				double 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++: #include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int m;
    vector<int> res(1000001, 0);
    for(int i=1; i<1000001; ++i) {
        int t = i;
        while(t % 2 == 0) {
            t /= 2;
        }
        while(t % 3 == 0) {
            t /= 3;
        }
        while(t % 5 == 0) {
            t /= 5;
        }
        res[i] = t == 1;
    }
    for(int i=1; i<1000001; ++i) {
        res[i] += res[i-1];
    }
    while(cin >> m, m) {
        int n;
        cin >> n;
        cout << res[n] - res[m-1] << endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    bool hamming[1000001]={};
    for(int i=1;i<1000001;i*=2){
        for(int j=i;j<1000001;j*=3){
            for(int k=j;k<1000001;k*=5)hamming[k]=1;
        }
    }
    int m;
    while(cin>>m,m){
        int n,co=0;
        cin>>n;
        for(int i=m;i<=n;i++)if(hamming[i])co++;
        cout<<co<<endl;
    }
}

C++: #include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

constexpr int LIM = 10000001;
char h[LIM];
int sh[LIM];

bool solve() {
    int m, n;
    cin >> m;
    if (m == 0) { return false; }
    cin >> n;
    cout << (sh[n] - sh[m-1]) << endl;
    return true;
}

int main() {
    fill(h, h+LIM, 0);
    h[1] = 1;
    for (int j = 2; j < LIM; ++j) {
        if (j % 2 == 0) { h[j] |= h[j/2]; }
        if (j % 3 == 0) { h[j] |= h[j/3]; }
        if (j % 5 == 0) { h[j] |= h[j/5]; }
    }
    sh[0] = 0;
    for (int j = 1; j < LIM; ++j) {
        sh[j] = sh[j-1] + h[j];
    }
    while(solve());
    return 0;
}

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

#define NMAX 1000000

int main() {
  int h[NMAX+1];
  int n[] = {2,3,5};
  int a, b, t;
  memset(h, 0, sizeof(h));
  h[1] = 1;
  for (int i=0; i<3; i++) {
    for (int j=1; j<=NMAX; j++) {
      if (!h[j]) continue;
      t = j * n[i];
      if (t <= NMAX) {
        h[t] = 1;
      }
    }
  }
  for (int i=1; i<=NMAX; i++) {
    h[i] += h[i-1];
  }
  while (1) {
    cin >> a;
    if (!a) break;
    cin >> b;
    cout << h[b]-h[a-1] << endl;
  }
  return 0;
}

C++: #include<stdio.h>
int cnt,flg;
int solve(int);
main(){
  int a,b,i;
  cnt=0;
  scanf("%d %d",&a,&b);
  for(i=a;i<=b;i++){
    flg=0;
    solve(i);
  }
  printf("%d\n",cnt);
  return 0;
}
int  solve(int a){
  if(flg==0){
  if(a==1||a==2||a==3||a==5){
    cnt++;
    flg=1;
    return;
  }
  if(a%2==0) solve(a/2);
  if(a%3==0) solve(a/3);
  if(a%5==0) solve(a/5);
  }
  return ;
}

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

set<int> hamming;
void make_hamming() {
  for(int i=0; i<100; i++)
    for(int j=0; j<100; j++)
      for(int k=0; k<100; k++) {
	int temp = pow(2.0, i)*pow(3.0, j)*pow(5.0, k);
	hamming.insert(temp);
      }
}

int main() {
  make_hamming();
  int m, n;
  while(cin >> m >> n && m) {
    set<int>::iterator it = hamming.begin();
    int cnt = 0;
    for(it; it!=hamming.end(); it++) {
      if(m<=*it && *it <=n) cnt ++;
    }
    cout << cnt << endl;
  }
  return 0;
}

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

bool hum[1000001];

int main(void)
{
	hum[1] = true;
	for(int i = 2; i <= 1000000; i *= 2)
		hum[i] = true;
	for(int i = 3; i <= 1000000; i *= 3)
		hum[i] = true;
	for(int i = 5; i <= 1000000; i *= 5)
		hum[i] = true;

	for(int i = 0; i <= 1000000; i++){
		if(hum[i]){
			for(int j = i; j <= 1000000; j *= 3)
				hum[j] = true;
			for(int j = i; j <= 1000000; j *= 5)
				hum[j] = true;
			for(int j = i; j <= 1000000; j *= 2)
				hum[j] = true;
		}
	}
	int n,m;
	while(cin >> n, n){
		cin >> m;
		int c = 0;
		for(int i = n; i <= m; i++)
			if(hum[i])
				c++;
		cout << c << endl;
	}


	return 0;
}

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

int main(){
    int m,n;
    
    while(cin >> m,m){
        cin >> n;
    
        int cnt = 0;
        for(int i = m ; i <= n ; i++){
            int tmp = i;
            while(!(tmp%2)||!(tmp%3)||!(tmp%5)){
                if(!(tmp%2)) tmp /= 2;
                else if(!(tmp%3)) tmp /= 3;
                else if(!(tmp%5)) tmp /= 5;
            }
            if(tmp == 1) cnt++;
        }
        cout << cnt << endl;
    }

    return 0;
}

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

int main(){
int num;
int sum[N];
int n,m;

sum[0] = 0;
num = 0;
for(int i=1;i<N;i++){
int tmp = i;
while(!(tmp%2))tmp/=2;
while(!(tmp%3))tmp/=3;
while(!(tmp%5))tmp/=5;
if(tmp==1)num++;
sum[i] = num;
}

while(1){
cin >> m;
if(!m)break;
cin >>n;
cout << sum[m] - sum[n-1] << endl;
}

C++: #include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int m,n,elem[3] = {2,3,5},tmp;
	int* table = new int[1000001];
	table[0] = 0;
	table[1] = 1;

	for(int i = 2; i <= 1000000; i++){
		tmp = i;
		for(int k = 0; k < 3; k++){
			while(tmp%elem[k] == 0){
				tmp /= elem[k];
			}
		}
		if(tmp == 1){
			table[i] = table[i-1]+1;
		}else{
			table[i] = table[i-1];
		}
	}


	while(true){
		scanf("%d %d",&m,&n);
		if(m == 0)break;

		printf("%d\n",table[n]-table[m]+1);
	}

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int m,n;
	while(cin>>m){
		if(m==0)break;
		cin>>n;
		int count=0;
		for(int i=m;i<=n;++i){
			int a=i;
			while((a%2==0)||(a%3==0)||(a%5==0)){
				if(a%2==0)a/=2;
				else if(a%3==0)a/=3;
				else if(a%5==0)a/=5;
			}
			if(a==1)count++;
		}
		cout<<count<<"\n";
	}
}