login
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.
1
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,1
COMMENTS
The sequence starts with the seed [2, 2].
Construction is similar to A347317 except using only prime numbers. Each row ends after counting the highest prime that has occurred in the sequence so far.
When the number of 2's, 3's, 5's, p's is not a prime number, the sequence outputs the prime number closest to but less than the actual count. See example below.
Allowing 0 and 1 in the series is necessary as some primes enter the series before earlier primes. For example, generate the sequence using the example provided below and note on row 47 where 61 appears before 59 in the sequence, approximately the 391st element of the sequence. The effect becomes very clear after generating about 110 rows of data and only gets greater from there, given the overall tendency for increasing gaps between prime numbers.
Related sequences could be generated using different seed strings. Interestingly starting with the seed [3, 3] produces an irregular triangle of similar shape to [2, 2]. This does not seem to occur with 5, 5.
Testing further pairs of primes [p,p] as seeds reveals a subsequence of primes 11,17,29,41,59,71,101,107... that all form a similarly shaped irregular triangle after a trivial amount of 'count up' rows. This can be seen by comparing the row lengths of each pair of primes seed.
It appears that when any of these subsequence values are used as a pair of primes seed that sequence will never include any of the subsequence values. For example, using seed [11,11] the count of 2's skips values 11,17,29,41,59,71,101,107... The same is true if the seed [17,17], or any of the other subsequence values, are used.
LINKS
EXAMPLE
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.
PROG
(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
CROSSREFS
Cf. A347317.
Sequence in context: A242626 A360387 A306399 * A240689 A233567 A141059
KEYWORD
nonn,base,tabf,changed
AUTHOR
Anthony B Lara, Sep 08 2024
STATUS
approved