%I #11 Jul 18 2022 19:20:49
%S 2,3,5,11,11,19,17,29,41,29,59,63,41,77,95,113,59,141,129,71,173,161,
%T 203,225,203,101,221,107,231,311,269,335,137,375,149,391,417,357,455,
%U 473,179,525,191,411,197,585,645,485,227,503,645,239,741,699,729,755,269,783
%N Replace the nonprimes in the prime gaps with primes. See Comments section for details.
%C Start with the sequence of the nonprime numbers. For visual clarity, it is interrupted with spaces where the primes are missing, and the nonprimes or their groups in the prime gaps are distinct:
%C 1 4 6 8 9 10 12 14 15 16 18 20 21 22 ...
%C Replace the first nonprime 1 with the first prime 2 and thereafter every single or every first nonprime in the prime gaps with successive primes:
%C 2 3 5 7 9 10 11 13 15 16 17 19 21 22 ...
%C Next, replace every second nonprime in the prime gaps with a new sequence of the primes:
%C 2 3 5 7 2 10 11 13 3 16 17 19 5 22 ...
%C Follow by replacing every third nonprime in the prime gaps with yet another prime sequence:
%C 2 3 5 7 2 2 11 13 3 3 17 19 5 5 ...
%C And so on. The sums of the substituting primes in the individual prime gaps form the terms of the sequence:
%C 2 3 5 11 11 19 17 29 ...
%o (MATLAB)
%o function a = A354400( max_prime )
%o % fill the gaps
%o p = primes(max_prime); b = [1:max_prime];
%o b(isprime(b) == 0) = 0;
%o pj = [0 find(b > 0)]; pjo = pj;
%o j = pj(b(pj+1) == 0)+1;
%o while ~isempty(j)
%o b(j) = p(1:length(j));
%o pj = find(b(1:end-1) > 0);
%o if ~isempty(find(b == 0, 1))
%o j = pj(b(pj+1) == 0)+1;
%o else
%o j = [];
%o end
%o end
%o % sum the gaps
%o k = 1;
%o for n = 1:length(pjo)-1
%o m = sum(b(pjo(n)+1:pjo(n+1)-1));
%o if m > 0
%o a(k) = m; k = k+1;
%o end
%o end
%o end % _Thomas Scheuerle_, May 25 2022
%Y Cf. A000040, A018252.
%K nonn
%O 1,1
%A _Tamas Sandor Nagy_, May 25 2022
|