Skip to main content
Bounty Ended with 200 reputation awarded by xnor
Improvement suggested
Source Link
m90
  • 10.7k
  • 1
  • 13
  • 46

JavaScript, 5252 51 bytes

h=x=>x%7||hfor(n=0;h=x=>x%7||h(x/7)
for(n=0;;;)~h(++n)%3||console.log(n)

Try it online!Try it online!

-1 thanks to Mukundan314.

The sequence contains the numbers that are congruent to 2 or 5 modulo 7 after removing all factors of 7.

This works because \$(\mathbb{Z}/7\mathbb{Z})^{\times}/\{1,-1\}\cong C_3\$, with \$\{1,2,3\}\$ mapping to the three distinct elements of \$C_3\$, so that for \$n\$ not divisible by 7, \$\{n,2n,3n\}\$ also map to the three distinct elements of \$C_3\$.

JavaScript, 52 bytes

h=x=>x%7||h(x/7)
for(n=0;;)~h(++n)%3||console.log(n)

Try it online!

This works because \$(\mathbb{Z}/7\mathbb{Z})^{\times}/\{1,-1\}\cong C_3\$, with \$\{1,2,3\}\$ mapping to the three distinct elements of \$C_3\$, so that for \$n\$ not divisible by 7, \$\{n,2n,3n\}\$ also map to the three distinct elements of \$C_3\$.

JavaScript, 52 51 bytes

for(n=0;h=x=>x%7||h(x/7);)~h(++n)%3||console.log(n)

Try it online!

-1 thanks to Mukundan314.

The sequence contains the numbers that are congruent to 2 or 5 modulo 7 after removing all factors of 7.

This works because \$(\mathbb{Z}/7\mathbb{Z})^{\times}/\{1,-1\}\cong C_3\$, with \$\{1,2,3\}\$ mapping to the three distinct elements of \$C_3\$, so that for \$n\$ not divisible by 7, \$\{n,2n,3n\}\$ also map to the three distinct elements of \$C_3\$.

Source Link
m90
  • 10.7k
  • 1
  • 13
  • 46

JavaScript, 52 bytes

h=x=>x%7||h(x/7)
for(n=0;;)~h(++n)%3||console.log(n)

Try it online!

This works because \$(\mathbb{Z}/7\mathbb{Z})^{\times}/\{1,-1\}\cong C_3\$, with \$\{1,2,3\}\$ mapping to the three distinct elements of \$C_3\$, so that for \$n\$ not divisible by 7, \$\{n,2n,3n\}\$ also map to the three distinct elements of \$C_3\$.