java
package cn.com;
import java.lang.*;//默认加载
public class C2 {
//10进制转8进制
static int HtoO(int n){
int cnt = 0;
while(n!=0){
cnt+=n%8;
n/=8;
}
return cnt;
}
//10进制转2进制
static int HtoB(int n){
int cnt = 0;
while(n!=0){
cnt+=n%2;
n/=2;
}
return cnt;
}
public static void main(String[] args) {
int i=0;
int n=1;
while(i<23){
if(HtoB(n)==HtoO(n)){
i+=1;
System.out.println(i+" "+ n);
}
n+=1;
}
}
}