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.
%I A348907 #42 Nov 10 2021 01:16:27 %S A348907 2,3,2,5,3,7,2,5,3,11,7,13,2,5,3,17,11,19,7,13,2,23,5,3,17,11,19,29,7, %T A348907 31,13,2,23,5,3,37,17,11,19,41,29,43,7,31,13,47,2,23,5,3,37,53,17,11, %U A348907 19,41,29,59,43,61,7,31,13,47,2,67,23,5,3,71,37,73,53,17,11 %N A348907 If n is prime, a(n) = n, else a(n) = a(n-pi(n)), n >= 2; where pi is the prime counting function A000720. %C A348907 A fractal sequence in which every term is prime. The proper subsequence a(k), for composite numbers k = 4,6,8,9... is identical to the original, and the records subsequence is A000040. %C A348907 Regarding this sequence as an irregular triangle T(m,j) where the rows m terminate with 2 exhibits row length A338237(m). In such rows m, we have a permutation of the least A338237(m) primes. - _Michael De Vlieger_, Nov 04 2021 %H A348907 Michael De Vlieger, <a href="/A348907/b348907.txt">Table of n, a(n) for n = 2..10238</a> (as an irregular triangle, rows 1 <= n <= 35 flattened). %H A348907 Michael De Vlieger, <a href="/A348907/a348907.png">Log-log scatterplot of a(n)</a>, for n=1..2^16. %e A348907 2 is prime so a(2) = 2. %e A348907 3 is prime so a(3) = 3. %e A348907 4 is not prime so a(4) = a(4-pi(4)) = 2. %e A348907 5 is prime so a(5) = 5. %e A348907 6 is composite so a(6) = a(6-pi(6)) = 3. %e A348907 From _Michael De Vlieger_, Nov 04 2021: (Start) %e A348907 Table showing pi(a(n)) for the first rows m of this sequence seen as an irregular triangle T(m,j). "New" primes introduced for prime n are shown in parentheses: %e A348907 m\j 1 2 3 4 5 6 7 8 9 10 11 A338237(m) %e A348907 ------------------------------------------------------------ %e A348907 1: (1) 1 %e A348907 2: (2) 1 2 %e A348907 3: (3) 2 (4) 1 4 %e A348907 4: 3 2 (5) 4 (6) 1 6 %e A348907 5: 3 2 (7) 5 (8) 4 6 1 8 %e A348907 6: (9) 3 2 7 5 8 (10) 4 (11) 6 1 11 %e A348907 ... (End) %t A348907 a[n_]:=If[PrimeQ@n,n,a[n-PrimePi@n]];Array[a,75,2] (* _Giorgos Kalogeropoulos_, Nov 03 2021 *) %o A348907 (PARI) a(n) = if (isprime(n), n, a(n-primepi(n))); \\ _Michel Marcus_, Nov 03 2021 %o A348907 (Python) %o A348907 from sympy import isprime %o A348907 def aupton(nn): %o A348907 alst, primepi = [], 0 %o A348907 for n in range(2, nn+1): %o A348907 if isprime(n): an, primepi = n, primepi + 1 %o A348907 else: an = alst[n - primepi - 2] %o A348907 alst.append(an) %o A348907 return alst %o A348907 print(aupton(76)) # _Michael S. Branicky_, Nov 04 2021 %Y A348907 Cf. A000040, A002808, A000720, A010051, A338237. %K A348907 nonn,look %O A348907 2,1 %A A348907 _David James Sycamore_, Nov 03 2021 %E A348907 More terms from _Michel Marcus_, Nov 03 2021