cp's OEIS Frontend

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.

A003160 a(1) = a(2) = 1, a(n) = n - a(a(n-1)) - a(a(n-2)).

This page as a plain text file.
%I A003160 M0446 #51 May 21 2025 18:43:17
%S A003160 1,1,1,2,3,4,4,4,5,5,5,6,6,6,7,8,9,9,9,10,11,12,12,12,13,14,15,15,15,
%T A003160 16,16,16,17,17,17,18,19,20,20,20,21,21,21,22,22,22,23,24,25,25,25,26,
%U A003160 26,26,27,27,27,28,29,30,30,30,31,32,33,33,33,34,35,36,36,36,37,37,37,38
%N A003160 a(1) = a(2) = 1, a(n) = n - a(a(n-1)) - a(a(n-2)).
%C A003160 Sequence of indices n where a(n-1) < a(n) appears to be given by A003156. - _Joerg Arndt_, May 11 2010
%C A003160 The number n appears A080426(n+1) times. - _John Keith_, Dec 31 2020
%D A003160 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A003160 Reinhard Zumkeller, <a href="/A003160/b003160.txt">Table of n, a(n) for n = 1..10000</a>
%H A003160 L. Carlitz, R. Scoville, and V. E. Hoggatt, Jr., <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/10-5/carlitz3-a.pdf">Representations for a special sequence</a>, Fibonacci Quarterly 10.5 (1972), 499-518, 550.
%F A003160 a(n) is asymptotic to n/2.
%F A003160 Conjecture: a(n) = E/2 where we start with A := n + 1, B := 0, L := A085423(A), C := A000975(L-1), D := 0, E := C and until A = B consecutively apply B := A, A := 2*C - A - (L mod 2) + 2, L := A085423(A), C := A000975(L-1), D := D + 1, E := (1 + [A = B])*E + (-1)^D*C. - _Mikhail Kurkov_, May 12 2025
%t A003160 Block[{a = {1, 1}}, Do[AppendTo[a, i - a[[ a[[-1]] ]] - a[[ a[[-2]] ]] ], {i, 3, 76}]; a] (* _Michael De Vlieger_, Dec 31 2020 *)
%o A003160 (PARI) a(n)=if(n<3,1,n-a(a(n-1))-a(a(n-2)))
%o A003160 (Haskell)
%o A003160 a003160 n = a003160_list !! (n-1)
%o A003160 a003160_list = 1 : 1 : zipWith (-) [3..] (zipWith (+) xs $ tail xs)
%o A003160    where xs = map a003160 a003160_list
%o A003160 -- _Reinhard Zumkeller_, Aug 02 2013
%o A003160 (SageMath)
%o A003160 @CachedFunction
%o A003160 def a(n): return 1 if (n<3) else n - a(a(n-1)) - a(a(n-2))
%o A003160 [a(n) for n in range(1, 81)] # _G. C. Greubel_, Nov 06 2022
%Y A003160 Cf. A003156, A005206, A080426, A095774, A095775.
%K A003160 nonn
%O A003160 1,4
%A A003160 _N. J. A. Sloane_
%E A003160 Edited by _Benoit Cloitre_, Jan 01 2003