Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #16 Jan 09 2021 21:05:16
%S 0,1,3,6,4,9,7,14,12,15,13,2,4,17,19,16,18,35,33,52,50,47,45,22,20,25,
%T 23,26,24,53,51,82,80,77,75,70,68,31,29,32,30,71,69,112,110,107,105,
%U 58,56,49,51,48,46,99,97,92,90,87,85,144,142,81,79,76,74,79,81,148,146,143,141,212,210
%N a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) - lpf(n) if nonnegative and not already in the sequence, otherwise a(n) = a(n-1) + lpf(n), where lpf(n) is the least prime dividing n.
%C This sequences uses the same rules as Recamán's sequence A005132 except that, instead of adding or subtracting n each term, the least prime dividing n is used. See A020639.
%C For the first 100 million terms the smallest value not appearing is 5. As any term for prime n can be the previous term minus n there is no apparent lower bound for the terms as n increases. For example a(16367081) = 601, the previous term being a(16367080) = 16367682. Thus it is possible 5, and eventually all values, are visited, although this is unknown.
%C In the same range the maximum value is a(98782561) = 602622357, and 7627043 terms repeat a previously visited value, the first time this occurs is a(12) = a(4) = 4. The longest run of consecutive increasing terms is 47, starting at a(96135288) = 26062, while the longest run of consecutive decreasing terms is 238, starting at a(32357989) = 160443385.
%H <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>.
%e a(2) = 3. As 2 is prime lpf(2) = 2 thus a(2) = a(1) + 2 = 1 + 2 = 3.
%e a(6) = 7. As lpf(6) = 2 and as 7 has not been previously visited and is nonnegative, a(6) = a(5) - 2 = 9 - 2 = 7.
%Y Cf. A005132, A020639, A000040, A336760.
%K nonn
%O 0,3
%A _Scott R. Shannon_, Aug 03 2020