C (GCC), 63 bytes
i;main(j){for(;;~j%7%3||printf("%d ",i))for(j=++i;j%7<1;)j/=7;}
Port of @m90's answer
C (gcc), 8282 74 bytes
-8 bytes thanks to @Digital Trauma
i;main(j,k){for(;;k%3||printf("%d ",i))for(k=ffs(j=++i)-1;j%3<1;j/=3)k--;}
Port of @math scat's answer