A342165 A fractal-like sequence: erase the terms that have a prime index, the non-erased terms rebuild the original sequence.
1, 2, 3, 2, 4, 3, 5, 2, 4, 3, 6, 5, 7, 2, 4, 3, 8, 6, 9, 5, 7, 2, 10, 4, 3, 8, 6, 9, 11, 5, 12, 7, 2, 10, 4, 3, 13, 8, 6, 9, 14, 11, 15, 5, 12, 7, 16, 2, 10, 4, 3, 13, 17, 8, 6, 9, 14, 11, 18, 15, 19, 5, 12, 7, 16, 2, 20, 10, 4, 3, 21, 13, 22, 17, 8, 6, 9, 14
Offset: 1
Examples
Original sequence: 1,2,3,2,4,3,5,2,4,3,6,5,7,2,4,3,8,6,9,5,7,2,10,4,3 Erasing: 1,(2,3,)2,(4,)3,(5,)2,4,3,(6,)5,(7,)2,4,3,(8,)6,(9,)5,7,2,(10,)4,3 Non-erased: 1,( )2,( )3,( )2,4,3,( )5,( )2,4,3,( )6,( )5,7,2,( )4,3 The non-erased terms rebuild the original sequence.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A303845.
Programs
-
PARI
a(n) = while(n>1 && !isprime(n), n-=primepi(n)); primepi(n)+1; \\ Kevin Ryde, Mar 03 2021
-
Python
from sympy import isprime def aupton(terms): alst, idx = [1], 1 for n in range(2, terms+1): if isprime(n): an = max(alst) + 1 else: an, idx = alst[idx], idx + 1 alst.append(an) return alst print(aupton(78)) # Michael S. Branicky, Mar 03 2021
Formula
a(prime(i)) = i + 1. - Michael S. Branicky, Mar 04 2021
Extensions
a(26) and beyond from Michael S. Branicky, Mar 03 2021
Comments