A336761 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.
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, 23, 26, 24, 53, 51, 82, 80, 77, 75, 70, 68, 31, 29, 32, 30, 71, 69, 112, 110, 107, 105, 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
Offset: 0
Keywords
Examples
a(2) = 3. As 2 is prime lpf(2) = 2 thus a(2) = a(1) + 2 = 1 + 2 = 3. 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.
Comments