login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #36 Nov 06 2024 04:33:46

%S 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,

%T 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,

%U 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

%N 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.

%C The sequence starts with the seed [2, 2].

%C 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.

%C 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.

%C 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.

%C 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.

%C 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.

%C 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.

%H Anthony B Lara, <a href="/A376076/b376076.txt">Table of n, a(n) for n = 1..19538</a>

%e 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.

%e As an irregular triangle this begins:

%e Row1: 2 (seed)

%e Row2: 2 (seed)

%e Row3: 2

%e Row4: 3 1

%e Row5: 3 2

%e Row6: 3 3

%e Row7: 3 5 1

%e Row8: 3 5 2

%e Row9: 5 5 3

%e 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.

%o (Python)

%o from itertools import islice

%o from collections import Counter

%o from sympy import isprime, nextprime, prevprime

%o def agen(verbose=False): # generator of terms; verbose=True prints rows

%o seed, bigp = [2, 2], 2

%o c = Counter(seed)

%o yield from seed

%o if verbose: [print(k, end=",\n") for k in seed]

%o while True:

%o p = 2

%o while p <= bigp:

%o cp = c[p]

%o if cp > 2 and not isprime(cp): cp = prevprime(cp)

%o if cp > bigp: bigp = cp

%o yield cp

%o if verbose: print(cp, end=", ")

%o c[cp] += 1

%o p = nextprime(p)

%o if verbose: print()

%o print(list(islice(agen(), 94))) # _Michael S. Branicky_, Sep 10 2024

%Y Cf. A347317.

%K nonn,base,tabf

%O 1,1

%A _Anthony B Lara_, Sep 08 2024