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 A076217 #33 Mar 21 2025 10:01:58 %S A076217 1,3,3,7,2,8,1,9,9,19,8,20,7,21,6,22,5,23,4,24,3,25,2,26,1,27,27,55, %T A076217 26,56,25,57,24,58,23,59,22,60,21,61,20,62,19,63,18,64,17,65,16,66,15, %U A076217 67,14,68,13,69,12,70,11,71,10,72,9,73,8,74,7,75,6,76,5,77,4,78,3,79,2,80 %N A076217 a(1)=1, a(n) = a(n-1) + n * sign(n-a(n-1)). %C A076217 a(n) = 1 correspond to n = A058481(m). - _Bill McEachen_, Aug 31 2023 %H A076217 Reinhard Zumkeller, <a href="/A076217/b076217.txt">Table of n, a(n) for n = 1..10000</a> %F A076217 If 3^n>2*m>= 2*3^(n-1); a(3^n-2*m) = m; if 3^n>2*m+1>=2*3^(n-1)+1 a(3^n-2*m-1) = 3^n - m; special case of partial sum: sum(k=1, 3^n, a(k)) = (3/8)*(9^n-1) + (3^(n+1)-1)/2. %F A076217 Conjecture: a(n) = -a(n-1)+a(n-2)+a(n-3) for n>5. G.f.: -x*(27*x^28 +54*x^27 +27*x^26 +9*x^10 +18*x^9 +9*x^8 +3*x^4 +6*x^3 +5*x^2 +4*x +1) / ((x -1)*(x +1)^2). - _Colin Barker_, Feb 25 2013 %F A076217 Regarding Barker's conjectured recurrence, it seems to fail at n= powers of 3, and the 2 successive terms. So it holds except for n= 9-11, 27-29, 81-83, 243-245, .... - _Bill McEachen_, Mar 21 2025 %e A076217 a(2) = a(1)+sign(2-a(1))*2 = 1 + 2 = 3. %t A076217 RecurrenceTable[{a[1]==1,a[n]==a[n-1]+n Sign[n-a[n-1]]},a[n],{n,80}] (* _Harvey P. Dale_, Jun 14 2011 *) %o A076217 (Haskell) %o A076217 a076217 n = a076217_list !! (n-1) %o A076217 a076217_list = 1 : zipWith (+) a076217_list %o A076217 (zipWith (*) [2..] $ map a057427 $ zipWith (-) [2..] a076217_list) %o A076217 -- _Reinhard Zumkeller_, Apr 21 2013 %o A076217 (PARI) alist(N) = my(r, t=0); vector(N, i, t=r=t+i*sign(i-t)); \\ _Ruud H.G. van Tol_, May 10 2024 %Y A076217 Cf. A005132. %Y A076217 Cf. A057427, A058481. %K A076217 nice,nonn,look %O A076217 1,2 %A A076217 _Benoit Cloitre_, Nov 03 2002