A085818 For n > 1: a(n) = p if n = p^e with p prime and e > 1, otherwise a(n) = (n-m)-th prime, where m = number of nonprime prime powers <= n; a(1)=1.
1, 2, 3, 2, 5, 7, 11, 2, 3, 13, 17, 19, 23, 29, 31, 2, 37, 41, 43, 47, 53, 59, 61, 67, 5, 71, 3, 73, 79, 83, 89, 2, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 7, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241
Offset: 1
Keywords
Links
- Michel Marcus, Table of n, a(n) for n = 1..10000
Programs
-
PARI
f(n) = 1 + sum(k=2, n, isprimepower(k) && !isprime(k)); \\ A085501 a(n) = {if (n==1, return (1)); my(p); if (isprimepower(n, &p) && !isprime(n), p, prime(n-f(n)));} \\ Michel Marcus, Jan 28 2021
-
Python
from sympy import primefactors, prime, primepi, integer_nthroot def A085818(n): return 1 if n==1 else (f[0] if len(f:=primefactors(n))==1 and f[0]
Chai Wah Wu, Aug 20 2024
Comments