A376076 A variant of the inventory sequence which only counts prime numbers and only allows the values in the sequence to be 0, 1, or a prime number.
2, 2, 2, 3, 1, 3, 2, 3, 3, 3, 5, 1, 3, 5, 2, 5, 5, 3, 5, 7, 5, 1, 5, 7, 7, 3, 5, 7, 7, 5, 5, 7, 7, 7, 5, 7, 11, 7, 1, 5, 7, 11, 11, 3, 5, 7, 13, 11, 3, 1, 5, 7, 13, 13, 3, 3, 5, 11, 13, 13, 5, 5, 5, 11, 17, 13, 5, 5, 1, 5, 11, 19, 13, 7, 7, 1, 1, 5, 11, 19, 13, 7, 7, 1, 2, 5, 11, 23, 17, 7, 7, 2, 2, 1
Offset: 1
Examples
The sequence can be thought of as a row by row counting of prime occurrences with each column relating to a specific prime number, given the first two seed rows of 2 and 2. As an irregular triangle this begins: Row1: 2 (seed) Row2: 2 (seed) Row3: 2 Row4: 3 1 Row5: 3 2 Row6: 3 3 Row7: 3 5 1 Row8: 3 5 2 Row9: 5 5 3 Note in Row8 how the number of 3's that have occurred so far is actually 6, but the rules of the sequence dictate outputting the nearest prime less than the count which is 5.
Links
- Anthony B Lara, Table of n, a(n) for n = 1..19538
Crossrefs
Cf. A347317.
Programs
-
Python
from itertools import islice from collections import Counter from sympy import isprime, nextprime, prevprime def agen(verbose=False): # generator of terms; verbose=True prints rows seed, bigp = [2, 2], 2 c = Counter(seed) yield from seed if verbose: [print(k, end=",\n") for k in seed] while True: p = 2 while p <= bigp: cp = c[p] if cp > 2 and not isprime(cp): cp = prevprime(cp) if cp > bigp: bigp = cp yield cp if verbose: print(cp, end=", ") c[cp] += 1 p = nextprime(p) if verbose: print() print(list(islice(agen(), 94))) # Michael S. Branicky, Sep 10 2024
Comments