%I
%S 5,15,13,23,21,27,31,37,41,39,43,57,63,61,67,81,76,74,80,70,65,71,81,
%T 95,88,94,87,85,78,92,83,81,95,88,102,97,88,87,101,100,93,103,117,115,
%U 106,104,94,104,95,86,76,71,62,76,67,77,91,82,72,76,67,73,64,62,52,62,53,44,42,41,45,35,49,40,31,22,36,34,33,31
%N Start with a(1) = 5. For n>1, the sequence is always extended with a(n+1) = a(n) + 2*d if d is prime, and with a(n+1) = a(n)  1  d if d is not prime, where d is the nth digit of the sequence.
%C If we start with a positive number less than 5 the sequence enters almost immediately into a 1term loop.
%C The authors wanted the sequence to oscillate evenly around zero by giving different weights to the nonprime vs prime digits: 0, 1, 4, 6, 8, 9 have respective weights 1, 2, 5, 7, 9, 10 (total 34) and 2, 3, 5, 7 become 4, 6, 10, 14 (same total 34).
%C The result is not convincing after 10^5 terms, the sequence staying for almost 95% of the time above zero. But who knows what will happen after 10^10 terms, for instance?
%H JeanMarc Falcoz, <a href="/A309620/b309620.txt">Table of n, a(n) for n = 1..65531</a>
%e The sequence S begins with 5,15,13,23,21,27,31,37,...
%e As a(1) = 5 and the 1st digit of S is prime (5), we get a(2) = a(1) + 2*5 = 5 + 10 = 15;
%e as a(2) = 15 and the 2nd digit of S is not prime (1), we get a(3) = a(2)  1  1 = 15  2 = 13;
%e as a(3) = 13 and the 3rd digit of S is prime (5), we get a(4) = a(3) + 2*5 = 13 + 10 = 23;
%e as a(4) = 23 and the 4th digit of S is not prime (1), we get a(5) = a(4)  1  1 = 23  2 = 21;
%e as a(5) = 21 and the 5th digit of S is prime (3), we get a(6) = a(5) + 2*3 = 21 + 6 = 27;
%e as a(6) = 27 and the 6th digit of S is prime (2), we get a(7) = a(6) + 2*2 = 27 + 4 = 31;
%e etc.
%Y Cf. A309521 (a variant).
%K base,sign
%O 1,1
%A _Eric Angelini_ and _JeanMarc Falcoz_, Aug 10 2019
