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
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Lars Blomberg, Aug 06 2019
EXTENSIONS
More terms from Rémy Sigrist, Aug 06 2019
STATUS
approved