

A309521


The sequence is always extended by subtracting the nth digit of the sequence from a(n) if a(n) is prime, else adding it to a(n), starting with a(1) = 4.


3



4, 8, 16, 17, 11, 10, 17, 16, 17, 16, 16, 17, 10, 11, 5, 4, 11, 10, 16, 17, 11, 10, 17, 16, 16, 17, 16, 21, 25, 26, 27, 28, 28, 29, 23, 22, 29, 28, 29, 28, 28, 29, 22, 23, 17, 16, 22, 23, 16, 17, 11, 9, 10, 12, 17, 15, 21, 23, 16, 18, 26, 28, 36, 38, 47, 45
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

Up to 10^6 the terms increase approximately linearly, and no cycles are visible. As we approach a million terms the terms are 3590238, 3590240, 3590242, 3590248, 3590251, 3590251, 3590257, 3590259, 3590261, 3590267, 3590270, 3590279, 3590285, 3590287, 3590289, 3590295, 3590298, 3590306, 3590312, 3590314, 3590316, 3590322, 3590326, 3590326, 3590332, 3590334, 3590336, 3590342, 3590346, ..., and the smallest values not yet encountered at that point are 2, 3, 6, 7, 13, 14, 19, 20, 24, 30, 31, 32, 33, 34, 35, 37, 39, 40, 41, 42, 43, 44, 46, 49, 51, 53, 55, 56, 57, 58, 59, 60, 61, 66, 67, 68, 69, 70, 75, 76, 77, 78, 79, 80, 81, 83, 85, 86, 87, 88, 89, 90, 91, 92, 100, 108, 109, 110, 113, 114, 115, 116, 117, 118, ...  Lars Blomberg, Aug 06 2019


LINKS

Lars Blomberg, Table of n, a(n) for n = 1..10000


EXAMPLE

The sequence starts with 4,8,16,17,11,10,17,16,...
As a(1) = 4 (not a prime), we have a(2) = a(1) + [the 1st digit of the seq] = 4 + 4 = 8;
as a(2) = 8 (not a prime), we have a(3) = a(2) + [the 2nd digit of the seq] = 8 + 8 = 16;
as a(3) = 16 (not a prime), we have a(4) = a(3) + [the 3rd digit of the seq] = 16 + 1 = 17;
as a(4) = 17 (a prime), we have a(5) = a(4)  [the 4th digit of the seq] = 17  6 = 11;
as a(5) = 11 (a prime), we have a(6) = a(5)  [the 5th digit of the seq] = 11  1 = 10;
etc.


PROG

(PARI) v=4; d=[]; for (n=1, 66, print1 (v ", "); d=concat(d, digits(v)); v+=d[n]*if (isprime(v), 1, +1)) \\ Rémy Sigrist, Aug 06 2019


CROSSREFS

Cf. A309529 (same idea, but dealing with even numbers instead of primes).
Sequence in context: A166634 A189007 A242349 * A072603 A123535 A312765
Adjacent sequences: A309518 A309519 A309520 * A309522 A309523 A309524


KEYWORD

base,nonn


AUTHOR

Eric Angelini and Lars Blomberg, Aug 06 2019


EXTENSIONS

More terms from Rémy Sigrist, Aug 06 2019


STATUS

approved



