A358338 a(n) = abs(a(n-1) - count(a(n-1))) where count(a(n-1)) is the number of times a(n-1) has appeared so far in the sequence, a(1)=0.
0, 1, 0, 2, 1, 1, 2, 0, 3, 2, 1, 3, 1, 4, 3, 0, 4, 2, 2, 3, 1, 5, 4, 1, 6, 5, 3, 2, 4, 0, 5, 2, 5, 1, 7, 6, 4, 1, 8, 7, 5, 0, 6, 3, 3, 4, 2, 6, 2, 7, 4, 3, 5, 1, 9, 8, 6, 1, 10, 9, 7, 3, 6, 0, 7, 2, 8, 5, 2, 9, 6, 1, 11, 10, 8, 4, 4, 5, 3, 7, 1, 12, 11, 9, 5, 4
Offset: 1
Examples
For n=2, a(2-1)=0 and 0 has occurred 1 time so far so a(2)=abs(0-1)=1. For n=12, a(12-1)=1 and 1 has occurred 4 times so far so a(12)=abs(1-4)=3.
Links
- Clément Vovard, Table of n, a(n) for n = 1..10000
Programs
-
Python
from collections import Counter def aupton(terms): alst, inventory = [0], Counter([0]) for n in range(2, terms+1): c = abs(alst[-1] - inventory[alst[-1]]) alst.append(c); inventory[c] += 1 return alst print(aupton(85)) # Michael S. Branicky, Nov 10 2022
Comments