This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A380037 #33 Jan 23 2025 12:51:36 %S A380037 0,-1,-1,1,-1,2,-1,2,1,3,-1,4,-1,2,4,2,2,1,7,-1,7,1,3,10,-1,5,-1,2,8, %T A380037 -1,3,5,4,14,-1,5,3,5,2,9,-1,6,-1,2,3,6,3,2,4,13,-1,8,18,-1,3,6,8,4,7, %U A380037 30,-1,7,2,12,-1,4,6,9,22,-1,5,26 %N A380037 For n >= 1, if there exists an m < n such that a(m) = a(n), take the largest such m and set a(n+1) as 1 more than the number of positive terms between a(m+1) and a(n-1). Otherwise, a(n+1) = -1. Start with a(1) = 0. %C A380037 This sequence was meant to be a version of A181391 that is more agnostic to individual natural numbers. When a new number is encountered, -1 is used as a placeholder instead of 0, and the -1 terms are not counted when determining the next term in the sequence. So, all natural numbers are in a sense treated equally. %C A380037 No zeros appear beyond the first term in the sequence. By the definition of the sequence, beyond the first term, all terms must be equal to -1 or an integer of value at least 1. %C A380037 a(n) < n for all n. a(1) < 1, and for n > 1 either a(n) = -1, which is less than n for all n, or there exists m < n - 1 such that a(m) = a(n - 1) and a(n) <= n - 1 - m which is less than n. %H A380037 Connor Criss, <a href="/A380037/b380037.txt">Table of n, a(n) for n = 1..10000</a> %o A380037 (Python) %o A380037 k = [0] %o A380037 i = 0 %o A380037 j = 0 %o A380037 n = 0 %o A380037 negatives = 0 %o A380037 total_vals = 0 %o A380037 MAX = 10000 %o A380037 #change value of MAX to modify number of terms generated %o A380037 index = 0 %o A380037 while(index < MAX): %o A380037 n = k[-1] %o A380037 i = len(k) - 2 %o A380037 j = 1 %o A380037 m = 0 %o A380037 while(i > -1): %o A380037 if(k[i] == k[-1]): %o A380037 k.append(j) %o A380037 m = 1 %o A380037 break %o A380037 if(k[i] != -1 or k[-1] == -1): %o A380037 j = j + 1 %o A380037 i = i - 1 %o A380037 if m == 0: %o A380037 k.append(-1) %o A380037 negatives = negatives + 1 %o A380037 index = index + 1 %o A380037 for x in range(MAX): %o A380037 print(str(k[x])) %o A380037 (PARI) a(max_n) = {my(v = [0], r = [], n = 1); while(#v < max_n, r = select(x->x==v[n], v, 1); if(#r>1, v=concat(v, [1+sum(m=r[#r-1]+1, r[#r]-1, v[m]>0)]), v=concat(v,[-1])); n++); v} \\ _Thomas Scheuerle_, Jan 11 2025 %Y A380037 Similar to the Van Eck sequence A181391. %K A380037 sign %O A380037 1,6 %A A380037 _Connor Criss_, Jan 10 2025