cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A343145 a(n) is the least positive number k such that applying x->prime(x) n times results in a number that ends in k.

Original entry on oeis.org

1, 7, 6447, 7, 1, 1, 69, 9, 1, 1, 1, 7, 1, 1
Offset: 0

Views

Author

Chai Wah Wu, Apr 06 2021

Keywords

Examples

			a(1) = 7 since prime(7) = 17 which ends in 7.
a(2) = 6447 since prime(prime(6447)) = 806447 which ends in 6447.
a(3) = 7 since prime(prime(prime(7)))=277 which ends in 7.
a(4) = 1 since prime(prime(prime(prime(1)))) = 11 which ends in 1.
a(5) = 1 since prime(prime(prime(prime(prime(1))))) = 31 which ends in 1.
a(6) = 69 since prime(prime(prime(prime(prime(prime(69)))))) = 54615469 which ends in 69.
a(7) = 9 since prime(prime(prime(prime(prime(prime(prime(9))))))) = 4535189 which ends in 9.
		

Crossrefs

Programs

  • PARI
    primemap(n, tms) = my(x=n); for(i=1, tms, x=prime(x)); x
    enddigits(n, len) = ((n/10^len - floor(n/10^len)) * 10^len)
    a(n) = for(k=1, oo, my(x=k); if(enddigits(primemap(k, n), #Str(k))==k, return(k))) \\ Felix Fröhlich, Apr 14 2021
  • Python
    def A343145(n):
        k = 1
        while True:
            m = k
            for _ in range(n):
                m = prime(m)
            if m % 10**(len(str(k))) == k:
                return k
            k += 1
            while not (k % 2 and k % 5):
                k += 1
    
Showing 1-1 of 1 results.