Cantor's unspeakable numbers

Python 2, 77 75 74 70 bytes

Thanks to @MartinEnder for suggesting the limit of 9e5 which enderd up working after a change.
Thanks to @mschauer for suggesting an infinite stream, saving 4 bytes.

def f(n=0):
 i=f()
 while 1:n+=1;yield next(i)if'7'in`n`or n%7<1else n

This is a generator that yields an infinite stream of the numbers.


Perl, 47 46 41 39 bytes

Saved 5 bytes thanks to @Dada

say$_=$_%7*!/7/?$_:$a[$b++]for@a=1..1e6

Try It Online! TIO Nexus, now with Perl support! This will truncate the output after a certain point, but if you have Perl installed, you can run it locally to produce the full output.

The code makes use of a couple of strange quirks of Perl's syntax, so I'll break down how it works below.

Code breakdown:

say$_=$_%7*!/7/?$_:$a[$b++]for@a=1..1e6
                              @a=1..1e6 #Assign the range (1..1,000,000) to the array @a
                           for          #and then loop through this list, with $_ as an alias for the list member.  As an alias, modifying $_ modifies @a.
      $_%7*!/7/?$_:$a[$b++]             #Ternary operation
      $_%7                              #Returns the residue modulo 7...
          *!/7/                         #...and multiplies it by the negation of whether or not there exists a 7 $_
                                        #Since % and * have the same operator precedence, it must be evaluated in this order
                                        #otherwise we would get (!/7/*$_)%7 instead of ($_%7)*!/7/
               ?$_                      #If the result is non-zero (i.e. truthy), then return $_
                  :$a[$b++]             #Otherwise, return the $b-th element of @a, and increment $b
   $_=                                  #Reassign the result back to $_, modifying @a
say                                     #Prints the result of the assignment, separated by newlines

Pyth, 25 23 22 bytes

Thanks to @Maltysen for -2 bytes

.V1=+Y
?}7+PbjbT@Y~hZb

A program that prints an infinite stream.

Try it online! (Output flushed at intervals and times out at 1 min)

How it works

.V1=+Y
?}7+PbjbT@Y~hZb

Z = 0, Y = []    Implicit variable assignment
.V1              Infinite incrementing for loop with variable b, starting at 1:
   =+Y            Y = Y +
(newline)          (Implicitly print the result of the following:)
?                   If
 }7                  7 is in
    Pb                the prime factorisation of b
   +                  or
      jbT             the digits of b:
         @Y            Index into Y at index
             Z          Z
           ~h          (Increment Z)
                    else:
              b      b