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.

A020703 Take the sequence of natural numbers (A000027) and reverse successive subsequences of lengths 1,3,5,7,...

This page as a plain text file.
%I A020703 #24 Jan 28 2019 19:19:45
%S A020703 1,4,3,2,9,8,7,6,5,16,15,14,13,12,11,10,25,24,23,22,21,20,19,18,17,36,
%T A020703 35,34,33,32,31,30,29,28,27,26,49,48,47,46,45,44,43,42,41,40,39,38,37,
%U A020703 64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,81,80,79,78,77
%N A020703 Take the sequence of natural numbers (A000027) and reverse successive subsequences of lengths 1,3,5,7,...
%C A020703 Arrange A000027, the natural numbers, into a (square) spiral, say clockwise as shown in A068225. Read the numbers from the resulting counterclockwise spiral of the same shape that also begins with 1 and this sequence results. - _Rick L. Shepherd_, Aug 04 2006
%C A020703 Contribution from _Hieronymus Fischer_, Apr 30 2012: (Start)
%C A020703 The sequence may also be defined as follows: a(1)=1, a(n)=m^2 (where m^2 is the least square > a(k) for 1<=k<n), if the minimal natural number not yet in the sequence is greater than a(n-1), else a(n)=a(n-1)-1.
%C A020703 A reordering of the natural numbers.
%C A020703 The sequence is self-inverse in that a(a(n))=n.
%C A020703 (End)
%D A020703 R. Honsberger, "Ingenuity in Mathematics", Table 10.4 on page 87.
%D A020703 Suggested by correspondence with Michael Somos.
%H A020703 Hieronymus Fischer, <a href="/A020703/b020703.txt">Table of n, a(n) for n = 1..11131</a>
%H A020703 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A020703 Contribution from _Hieronymus Fischer_, Apr 30 2012: (Start)
%F A020703 a(n)=a(n-1)-1, if a(n-1)-1 > 0 is not in the set {a(k)| 1<=k<n}, else a(n)=m^2, where m^2 is the least square not yet in the sequence.
%F A020703 a(n)=n for n=k(k+1)+1, k>=0.
%F A020703 a(n+1)=(sqrt(a(n)-1)+2)^2, if a(n)-1 is a square, a(n+1)=a(n)-1, else.
%F A020703 a(n)=2*(floor(sqrt(n-1))+1)*floor(sqrt(n-1))-n+2. (End)
%e A020703 a(2)=4=2^2, since 2^2 is the least square >2=a(1) and the minimal number not yet in the sequence is 2>1=a(1);
%e A020703 a(8)=6=a(7)-1, since the minimal number not yet in the sequence (=5) is <=7=a(7).
%t A020703 Flatten[Table[Range[n^2,(n-1)^2+1,-1],{n,10}]] (* _Harvey P. Dale_, Jan 10 2016 *)
%t A020703 With[{nn=20},Flatten[Reverse/@TakeList[Range[nn^2],Range[1,nn,2]]]] (* Requires Mathematica version 11 or later *) (* _Harvey P. Dale_, Jan 28 2019 *)
%o A020703 (PARI) a(n)=local(t); if(n<1,0,t=sqrtint(n-1); 2*(t^2+t+1)-n)
%Y A020703 A self-inverse permutation of the natural numbers.
%Y A020703 Cf. A000027, A038722.
%Y A020703 Cf. A132666, A132664, A132665, A132674.
%K A020703 nonn
%O A020703 1,2
%A A020703 _N. J. A. Sloane_, May 02 2000