g | x | w | all
Bytes Lang Time Link
259Python250523T085834ZAhamad
056Ruby250519T195536ZJordan
115TIBASIC TI83 Plus250522T130024Zmadeforl
00805AB1E250521T141508ZKevin Cr
015Vyxal 3250521T092418ZThemooni
076JavaScript V8250519T212838ZArnauld
013Pyth250520T150713ZCursorCo
039Charcoal250520T074016ZNeil
069Retina250520T071423ZNeil
078Maple250520T001916Zdharr
065Factor + lists.lazy math.primes.factors250519T224741Zchunes
010Vyxal r250519T223847Zpacman25
064Arturo250519T214851Zchunes
028Uiua 0.17.0dev.1250519T202941ZTbw
196Racket250519T194827ZGalen Iv
012Jelly250519T193513ZJonathan
112JQ250519T184612Zmousetai

Python, 259 bytes


Golfed version. Try It Online!

def C(n):
    B=[];A=2
    while n>1:
        while n%A==0:B.append(A);n=n//A
        A+=1
    return B
def D(factors):
    A={}
    for B in factors:A[B]=A.get(B,0)+1
    return A
A=10
while True:
    E=C(A-1);F=D(E);B=False
    for(H,G)in F.items():
        if G==A:B=True;break
    if B:print(A)
    A+=1

Ungolfed version. Try It Online!

def get_prime_factorization(n):
    """Get prime factorization of n as a list of factors"""
    factors = []
    divisor = 2
    
    while n > 1:
        while n % divisor == 0:
            factors.append(divisor)
            n = n // divisor
        divisor += 1
    
    return factors

def count_factor_occurrences(factors):
    """Count occurrences of each factor"""
    counts = {}
    for factor in factors:
        counts[factor] = counts.get(factor, 0) + 1
    return counts

# Main loop starting from k = 10
k = 10
while True:
    factors = get_prime_factorization(k - 1)
    factor_counts = count_factor_occurrences(factors)
    
    # Check if any factor appears exactly k times
    found = False
    for factor, count in factor_counts.items():
        if count == k:
            found = True
            break
    
    if found:
        print(k)
    
    k += 1

Ruby, 56 bytes

-10 bytes thanks to Value Ink

Prints the sequence indefinitely.

i=2
loop{p i if/#{i.prime_division[-1][0]}$/=~"#{i+=1}"}

Attempt This Online!

TI-BASIC (TI-83 Plus), 115 bytes

not my proudest one.

Input I
1→O
While I
O+2→O
O-1→N
For(A,N-1,2,-1
N/A→Z
If not(fPart(Z
Then
sum(not(fPart(seq(Z/B,B,2,Z→C
If C=1
Z→U
End
End
If sum(seq(U=₁₀^(E)fPart(O/₁₀^(E)),E,1,1+log(O
Then
Disp O
I-1→I
End
End

Keep in mind this is EXTREMELY SLOW.

this is 1-indexed

05AB1E, 9 8 bytes

∞ʒD<fθÅ¿

Outputs a lazy infinite list.

Try it online.

Explanation:

∞         # Push an infinite positive list: [1,2,3,...]
 ʒ        # Filter this list by:
  D       #  Duplicate the current value
   <      #  Decrease the copy by 1
    f     #  Pop and push a list of its prime factors
     θ    #  Pop and leave the last/maximum value
          #  (for n=1 or n=2, the list is empty, and this will be a no-op)
      Å¿  #  Check whether the value has this maximum prime factor as prefix
          #  (which will be falsey for the empty lists of n=1 or n=2)
          # (after which the infinite lazy list is output implicitly)

Vyxal 3, 15 bytes

kNʎ‹K~℗G⇄n⇄Pc}i

There's probably a better way to check for suffixes than this but i can't figure it out. My lack of sleep doesn't help.

Vyxal It Online!

kNʎ‹K~℗G⇄n⇄Pc}i­⁡​‎‎⁡⁠⁤⁣‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁣‏⁠‎⁡⁠⁤⁢‏⁠‏​⁡⁠⁡‌⁤​‎‎⁡⁠⁤‏⁠⁠⁠‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏‏​⁡⁠⁡‌­
              i  # ‎⁡index implicit input in list
kN               # ‎⁢natural numbers
  ʎ          }   # ‎⁣filtered by...
   ‹             # ‎⁤is n-1's
    K~℗G         # ‎⁢⁡biggest prime factor
        ⇄n⇄Pc    # ‎⁢⁢a suffix of n?
💎

Created with the help of Luminespire.

<script type="vyxal3">
kNʎ‹K~℗G⇄n⇄Pc}i
</script>
<script>
    args=[["0"],["1"],["2"],["3"]]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>

JavaScript (V8), 76 bytes

Prints the sequence indefinitely.

for(k=9;++k;)(g=x=>x>1?g(x%d++?x:x/--d):k+g)(k-1,d=2).match(d+"x")&&print(k)

Try it online!


JavaScript (ES6), 79 bytes

Returns the \$n\$-th term of the sequence, 1-indexed.

f=(n,k)=>!(g=x=>x>1?g(x%d++?x:x/--d):k+g)(k-1,d=2).match(d+"x")||n--?f(n,-~k):k

Try it online!

Commented

f = (           // f is a recursive function taking:
  n,            //   n = input
  k             //   k = counter, initially undefined
) =>            //
!(              //
  g = x =>      // g is a recursive function taking x:
  x > 1 ?       //   if x is greater than 1:
    g(          //     do a recursive call to g:
      x % d++ ? //       if d is not a divisor of x
                //       (increment d afterwards):
        x       //         leave x unchanged
      :         //       else:
        x / --d //         restore d and divide x by d
    )           //     end of recursive call
  :             //   else:
    k + g       //     return k, converted to a string with
)               //     a suffix starting with "x"
(k - 1, d = 2)  // initial call to g with k - 1 and d = 2
.match(d + "x") // if d is not a suffix of k
|| n-- ?        // or n is not 0 (decrement it afterwards):
  f(n, -~k)     //   try again with k + 1
:               // else:
  k             //   stop and return k

Pyth, 13 bytes

.f!x_`Z_`&FPt

Try it online!

Outputs the first n numbers.

Explanation

.f!x_`Z_`&FPtZQ    # implicitly add ZQ
                   # implicitly assign Q = eval(input())
.f            Q    # return the first Q integers that are truthy in lambda Z
            tZ     #   Z - 1
           P       #   prime factors as a sorted list
         &F        #   take the last element (unless list is empty, then return [])
       _`          #   stringify and reverse
   x_`Z            #   find within Z stringified and reversed
  !                #   not (is truthy only when result is 0)

Charcoal, 39 bytes

NθW‹ⅉθ«≦⊕χ¿¬⌕⮌Iχ⮌I⊟Φ…²χ∧¬﹪⊖χκ⬤…²κ﹪κμ⟦Iχ

Try it online! Link is to verbose version of code. Outputs the first n numbers. Explanation:

Nθ

Input n.

W‹ⅉθ«

Repeat until n numbers have been output.

≦⊕χ

Increment k, using the variable that is predefined to the value 10.

¿¬⌕⮌Iχ⮌I⊟Φ…²χ∧¬﹪⊖χκ⬤…²κ﹪κμ

Find all factors of k-1, filter on those that are prime, take the largest, and see wither k ends with it.

⟦Iχ

If so then output k.

Retina, 69 bytes

K`9
"$+"{/(.+)¶\1$/^{L$`^.+
$.(*__)¶$&*
+`¶(__+)\1+$
¶$1
)`_+
$.&
G`^

Try it online! Outputs the 1-indexed nth number. Explanation:

K`9

Start with k=9.

"$+"{`

Repeat n times.

L$`^.+
$.(*__)¶$&*

Increment k, then follow it with the new k-1 in unary.

+`¶(__+)\1+$
¶$1

Find the largest prime factor of k-1.

_+
$.&

Convert it back to decimal.

/(.+)¶\1$/^`{
)`

Repeat until k ends with that prime factor. (The inner loop automatically restarts because the prime factor was removed on the previous iteration of the outer loop.)

G`^

Remove the prime factor.

Maple, 78 bytes

for n do`if`(n mod 10^(1+ilog10((p:=max(op~(ifactors(n-1)[2])))))=p,n,NULL)od;

Prints an infinite sequence. A golfed version of @Robert Israel's code on the OEIS page.

Factor + lists.lazy math.primes.factors, 65 bytes

[ 3 lfrom [ dup >dec swap 1 - factors last >dec tail? ] lfilter ]

Attempt This Online!

Returns a lazy list of the sequence.

Vyxal r, 10 bytes

λ‹ǏGSnøE;ȯ

Try it Online!

Vyxal 3 still needs a prime factors element but it has prime exponents :p

Arturo, 65 64 bytes

$=>[select.n:&1..∞'x->suffix?~"|x|"~"|x-1last factors.prime|"]

Try it!

Returns the 1-indexed \$n\$th term.

Uiua 0.17.0-dev.1, 28 bytes SBCS

⍥(+1.⍢+₁(¬⊢⌕∩⇌∩°⋕⊣°/×-1.))⊙3

Try on Uiua Pad!

Takes \$n\$ on the stack and outputs an array with the first \$n\$ terms.

Explanation

⍥(+1.⍢+₁(¬⊢⌕∩⇌∩°⋕⊣°/×-1.))⊙3
⊙3             # Starting at 3
⍥              # do the following n times...
(¬⊢⌕∩⇌∩°⋕⊣°/×-1.)# test if n is NOT an echo number:
°/×-1.             # factor n-1
⊣                  # last factor
∩°⋕                # stringify both
∩⇌                 # reverse both
⌕                  # find occurances
¬⊢                 # !(first element)
⍢+₁              # add 1 while TRUE
+1.              # leave result on stack, add 1, start over

Racket, 196 bytes

(require math/number-theory)
(define(f n[i 3])(let([k(+ i 1)][e(car(last(factorize(- i 1))))])(if(= 0 n)'()(if(= 0(modulo(- i e)(expt 10(ceiling(/(log e)(log 10))))))(cons i(f(- n 1)k))(f n k)))))

Try it online!

Returns the first n echo numbers.

TIO doesn't seem to recognize (log z [b]) and that's why I used (/ (log z) (log b)) instead. The suffix matching could most probably be done nuch shorter with regex.

Jelly, 12 bytes

DḌÐƤf’ÆfṪƊƲ#

A full program that accepts the count, \$n\$, from stdin and prints the first \$n\$ echo numbers.

Try it online!

How?

DḌÐƤf’ÆfṪƊƲ# - Main Link: no arguments
           # - start at k=0 and count up finding the first {stdin} k for which:
          Ʋ  -   last four links as a monad - f(k):
D            -     decimal digits of {k}
 ḌÐƤ         -     convert suffixes of {that} from decimals to integers
         Ɗ   -     last three links as a monad - f(k):
     ’       -       decrement {k}
      Æf     -       prime factors
        Ṫ    -       tail (maximal)
    f        -    {suffix integers} filter keep {maximal prime factor of k-1}
             - implicit print

JQ, 112 bytes

1|recurse(.+1)|select(. as$b|"\(.)"|test($b-1|last(recurse(. as$a|./first(range(2;.)|select($a%.<1))))|"\(.)$"))

Link: https://play.jqlang.org/s/1H_9T-EpbqgqtMA