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<vector>
#include<string>
using namespace std;

bool hamming(int a) {
	while (1) {
		if (a == 1)return true;
		if (a % 2 == 0) a /= 2;
		else if (a % 3 == 0) a /= 3;
		else if (a % 5 == 0) a /= 5;
		else return false;
	}
}
int main()
{
	while (1) {
		int a;
		cin >> a;
		if (a == 0)break;
		int b;
		cin >> b;
		int s = 0;
		for (int c = a; c < b + 1; c++) {
			if (hamming(c))s++;
		}
		cout << s << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
bool ham[1000001];
int main(){
  ham[1]=1;
  for(int i=0;i<1000001;i++)
    if(ham[i]){
      if(i*2<1000000)ham[i*2]=1;
      if(i*3<1000000)ham[i*3]=1;
      if(i*5<1000000)ham[i*5]=1;
    }
  int x,y;
  while(cin>>x,x){
    cin>>y;
    int sum=0;
    for(int i=x;i<=y;i++)
      if(ham[i])sum++;
    cout<<sum<<endl;
  }
}

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

#define MAX 1000001
bitset<MAX> bs;
int mul[3] = { 2,3,5 };

int main(){
	bs.set(1);
	int p;
	for (int i = 0; i < MAX; i++) {
		if (bs[i]) {
			for (int j = 0; j < 3; j++) {
				p = i*mul[j];
				if (p < MAX) {
					bs.set(p);
				}
			}
		}
	}
	int m, n, c;
	while (scanf("%d", &m), m != 0) {
		scanf("%d", &n);
		c = 0;
		for (int i = m; i <= n; i++) {
			if (bs[i])c++;
		}
		
		printf("%d\n", c);
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

const int MAX = 1000001;

int main() {
    bool h[MAX] = {};
    for(int i = 1;i < MAX; i *= 2){
        for(int j = i; j < MAX; j *= 3){
            for(int k = j; k < MAX; k *= 5 ) h[k]=1;
        }
    }
    int m;
    while(cin >> m, m) {
        int n, count = 0;
        cin >> n;
        for(int i = m;i <= n; i++) if(h[i]) count++;
        cout << count << endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main()
{
  int m;
  vector<int> count;
  for(int i=0;i<6;i++)
    count.push_back(i);
  for(int i=6;i<10000001;i++)
    {
      if((i%2==0&&count[i/2]-count[(i/2)-1]!=0) || (i%3==0&&count[i/3]-count[(i/3)-1]!=0) || (i%5==0&&count[i/5]-count[(i/5)-1]!=0))
	  count.push_back(count[i-1]+1);
      else
	count.push_back(count[i-1]);
    }
  for(;cin>>m,m;)
    {
      int n;
      cin>>n;
      cout<<count[n]-count[m-1]<<endl;
    }
}

C++: #include <iostream>

using namespace std;

int main()
{
  int n, m, a[1000000], p = 0, c, t;

  for(int i = 1; i < 1000000; i++){
    t = i;
    while(t%5 == 0){
      t /= 5;
    }
    while(t%3 == 0){
      t /= 3;
    }
    while(t%2 == 0){
      t /= 2;
    }
    if(t == 1){
      a[p++] = i;
    }
  }

  while(1){
    cin >> m;
    if(m == 0){
      break;
    }
    cin >> n;
    c = 0;
    for(int i = 0; i < p && a[i] <= n; i++){
      if(m <= a[i]){
	c++;
      }
    }
    cout << c << endl;
  }

  return 0;
}

C++: #include <vector>
#include <iostream>

using namespace std;

unsigned long long power(int a, int b)
{
	if (b == 0) { return 1LL; }

	return power(a, b - 1) * a;
}

int main()
{
	vector<bool> s(1000001, false);

	for (int i = 0; i < 20; i++)
	{
		for (int j = 0; j < 12; j++)
		{
			for (int k = 0; k < 8; k++)
			{
				unsigned long long sum = power(2, i) * power(3, j) * power(5, k);

				if (sum <= 1000000ULL)
				{
					s[sum] = true;
				}
			}
		}
	}

	int m, n;

	while (cin >> m >> n)
	{
		int sum = 0;

		for (int i = m; i <= n; i++)
		{
			sum += (s[i] ? 1 : 0);
		}

		cout << sum << endl;
	}

	return 0;
}

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

using namespace std;

bool prime[1000001];
int ans[1000001];

void erat()
{

    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i < 10000; i++) {
        prime[i] = true;
    }

    for (int i = 2; i < 500001; i++) {
        if (prime[i]) {
            for (int j = 2; j*i < 1000001; j++) {
                prime[i*j] = false;
            }
        }
    }
}

void solve()
{
    ans[0] = 0;
    for (int i = 1; i < 1000001; i++) {
        ans[i] = 1;
    }
    for (int i = 7; i < 1000001; i++) {
        if (prime[i]) {
            for (int j = 2; i*j < 1000001; j++) {
                ans[i*j] = 0;
            }
            ans[i] = 0;
        }
    }
    for (int i = 1; i < 1000001; i++) {
        ans[i] += ans[i-1];
    }
}




int main() 
{
    int m, n;
    cin >> m;

    erat();
    solve();

    while (m) {
        cin >> n;
        cout << ans[n] - ans[m-1] << endl;
        cin >> m;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

int m, n;

int check(int num) {
    if (m <= num && num <= n) return 1;
    return 0;
}

int main (int argc, char *argv[]) {
    while (cin >> m >> n, m) {
        int base = 1;
        int ans = 0;
        for (int i = 0; i  <= int(n/2); ++i)    {
            for (int j = 0; j <= int(n/3); ++j) {
                for (int k = 0; k <= int(n/5); ++k) {
                    ans += check(pow(2, i) * pow(3, j) * pow(5, k));
                }
            }
        }
        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 if(i%2==0||i%3==0||i%5==0){
                long long int kawa=60;
                for(int j=0;j<7;j++){
                    if(kawa%i==0){
                        co++;
                        break;
                    }
                    kawa*=60;
                }
            }
        }
        cout<<co<<endl;
    }
}

C++: #include <iostream>
#include <vector>

using namespace std;
const long ma = 1000010;
bool hams[ma];
void ham(long);

void gen(){
    for(int i=0;i<ma;i++){
        hams[i] = false;
    }
    ham(1);
}

void ham(long n){
    if(n > ma) return;
    if(hams[n]) return;
    hams[n] = true;
    ham(2*n);
    ham(3*n);
    ham(5*n);
}

int count(int m,int n){
    int c;
    for(int i=m;i<n+1;i++){
        if(hams[i]) c++;
    }
    return c;
}

int main(){
    gen();
    int m,n;
    while(true){
        cin >> m;
        if(m==0)break;
        cin >> n;
        cout << count(m,n) << endl;
    }
}

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

int main(){
  int m;
  int n,a,cnt;
  m =0 , n=0, a=0, cnt =0;
  while(1){
    cin >> m;
    if(m == 0) break;
    cin >> n;
 
    for(int i=m;i<n;i++){
      a = i;
      
      while(a / 2 ==0) a = a / 2;
      while(a / 3 ==0) a = a / 3;
      while(a / 5 ==0) a = a / 5;

      if(a == 1) cnt++;
    }


    cout << cnt << endl;
    cnt =0;

  }



}

C++: #include<bits/stdc++.h>
#define MAX 1000001
using namespace std;
int main()
{
    bool hamming[MAX]={};
    for(int i=1;i<MAX;i*=2){
        for(int j=i;j<MAX;j*=3){
            for(int k=j;k<MAX;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;
    }
}