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 <stdio.h>
#include <stdlib.h>
#define N 10000000
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 "bits/stdc++.h"
using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP(a, b) make_pair(a, b)
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int n, m;
vector<pi> s;
int dp[1024];
using namespace std;

int main() {
    int m, n;
    bool a[1000010];
    int b[1000010];

    for(int i = 0; i < 1000010; i++)
        a[i] = false;

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

    b[0] = 0;
    for(int i = 1; i < 1000010; i++) {
        b[i] = b[i - 1] + (a[i] ? 1 : 0);
    }

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

    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int N = 1000000;
  bool dp[N+1];
  dp[1] = true;
  for (int i=2; i<N; ++i) {
    if (i%2==0&&dp[i/2] || i%3==0&&dp[i/3] || i%5==0&&dp[i/5])
      dp[i] = true;
  }
  int m,n;
  while(cin>>m,m) {
    cin >> n;
    cout << count(dp+m, dp+n+1, true) << endl;
  }
}

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

int main() {
  int m, n;

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

    int count = 0;
    for(int i = m; i <= n; i++) {
      if(i % 2 == 0)
        continue;
      else if(i % 3 == 0)
        continue;
      else if(i % 5 == 0)
        continue;
      else {
	count++;
      }
    }
    cout << (n - count - m + 1) << endl;
  }
  return 0;
}

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

bool isHamming(int x){
		int j=x;
		while(j%2==0)
			j=j/2;
		while(j%3==0)
			j=j/3;
		while(j%5==0)
			j=j/5;
		if(j==1)
			return true;
		else
			return false;
}
	
int main(){

	while(true){
		int m,n;
		cin >> m;

		if(m==0)
			break;

		cin >> n;
	
		int ans=0;
		for(int i=m; i<=n; i++){
			if(isHamming(i))
				ans++;
		}
		cout << ans<< endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int m, n;
	vector<int>v(1000001, 1);
	v[0] = v[1] = 0;
	for (int i = 2; i <= sqrt(1000000); i++) {
		if (v[i]) {
			for (int j = 0; i*(j+2) <= 1000000; j++) {
				v[i*(j+2)] = 0;
			}
		}
	}
	//for (int i = 2; i < 100; i++) {
	//	if (v[i])printf("%4d", i);
	//}
	//cout << endl;

	while (cin >> m >> n, m) {
		int cnt = 0;
		for (int i = m; i <= n; i++) {
			if (i == 1)cnt++;
			bool f = false;
			bool g = false;
			if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) {
				g = true;
			}
			for (int j = 7; j < i; j++) {
				if (v[j] && i%j == 0) {
					f = true;
					break;
				}
			}
			if (!f&&g)cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
/*
bool sw[1000001];
int i;
 
void sws(int k){
        if(k==1){
                sw[i]=true;
                return;
        }
        if(k%2==0) sws(k/2);
        else if(k%3==0) sws(k/3);
        else if(k%5==0) sws(k/5);
        return;
}
*/
// korenisuru
int dp[1000001];
int f(int n){
        if(~dp[n]) return dp[n];
        int ans = 0;
        else if(n%2==0) ans |= f(n/2);
        else if(n%3==0) ans |= f(n/3);
        if(n%5==0) ans |= f(n/5);
        return dp[n] = ans;
}
 
int main() {
        int k,m,n;
        for(int i = 0 ; i <= 1000000 ; i++) dp[i] = -1;
        dp[1] = 1;
        /*
        for(int j=0;j<1000001;j++) sw[j]=false;
        for(i=1;i<1000001;i++) sws(i);
        while(cin >> m,m){
                int ans=0;
                cin >> n;
                for(int j=m;j<=n;j++) if(sw[j]==true) ans++;
                cout << ans << endl;
        }*/
        while(cin >> m && m){
                cin >> n;
                int ans = 0;
                for(int i = m ; i <= n ; i++) ans += f(i);
                cout << ans << endl;
        }
        return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int m;
    while(cin>>m,m){
        int n,co=0;
        cin>>n;
        for(int i=m;i<=n;i++){
            if(i==1)co++;
            else{
                long long int kawa=60;
                for(int j=0;j<12;j++){
                    if(kawa%i==0){
                        co++;
                        break;
                    }
                    kawa*=60;
                }
            }
        }
        cout<<co<<endl;
    }
}

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

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

C++: //35
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  static bool hm[1000001]={false,true};
  for(int i=0;i<=1000000;i++){
    for(int j=0;j<3;j++){
      int f[]={2,3,5};
      if(hm[i]&&i*f[j]<=1000000){
	hm[i*f[j]]=true;
      }
    }
  }
  for(int m,n;cin>>m>>n;){
    cout<<count(hm+m,hm+n+1,true)<<endl;
  }
  return 0;
}

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

int main() {
  int m, n;

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

    int count = 0;
    for(int i = m; i <= n; i++) {
      if(i % 2 == 0)
        continue;
      else if(i % 3 == 0)
        continue;
      else if(i % 5 == 0)
        continue;
      else {
        cout <<	i << endl;
        count++;
      }
    }
    cout << (m - count - n - 1) << endl;
  }
  return 0;
}