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.

A182321 Number of iterations of A025581(n) required to reach 0.

This page as a plain text file.
%I A182321 #24 Dec 06 2019 21:43:23
%S A182321 0,1,2,1,3,2,1,2,3,2,1,4,2,3,2,1,3,4,2,3,2,1,2,3,4,2,3,2,1,3,2,3,4,2,
%T A182321 3,2,1,4,3,2,3,4,2,3,2,1,3,4,3,2,3,4,2,3,2,1,2,3,4,3,2,3,4,2,3,2,1
%N A182321 Number of iterations of A025581(n) required to reach 0.
%C A182321 Following the notation in the link, for n >= 0, let n = (0 + 1 + 2 + ... + f(n)) - g(n) be the representation of n with f(n) and g(n) minimal such that 0 <= g(n) <= f(n).  Then f(n) = A002024(n) = round(sqrt(2n)), and g(n) = A025581(n) = f(n)*(f(n)+1)/2 - n.
%C A182321 With this notation, a(n) is the number of iterations of g(n) needed to reach 0.
%C A182321 The sequence a(n) is essentially the function phi(n) of the link.
%C A182321 The sequence a(n) has a high degree of fractal-like symmetry.  Consider, for instance, the sequence in the triangular array (read left to right then top to bottom, with the term for a(0) on top):
%C A182321            0
%C A182321            1
%C A182321         2  1
%C A182321      3  2  1
%C A182321   2  3  2  1
%C A182321 Then the rows of this triangle (read from right to left) are simply 1+a(n).
%C A182321 a(n) is related to the recurrence between A186053 and A182298.
%C A182321 For n >= 1, a(n) is the number of terms in the minimal alternating triangular-number representation of n+1, defined at A255974. - _Clark Kimberling_, Apr 10 2015
%H A182321 Clark Kimberling, <a href="/A182321/b182321.txt">Table of n, a(n) for n = 0..1000</a>
%H A182321 Patrick Devlin, <a href="http://arxiv.org/abs/1202.1331">Integer Subsets with High Volume and Low Perimeter</a>, arXiv:1202.1331v1 [math.CO]
%F A182321 The Devlin link shows a(n) < log_2(log_2(n/2)) + 2.
%e A182321 g(8) = 2, g(2) = 1, g(1) = 0.  Therefore a(8) = 3.
%p A182321 # With this code, the n-th term of the sequence is given by a call to a(n)
%p A182321 f:=n->round(sqrt(2*n)): g:=n->f(n)*(f(n)+1)/2-n:
%p A182321 a:=proc(n) option remember:
%p A182321   if n < 1 then return 0: fi: return 1 + a(g(n)):
%p A182321 end proc:
%t A182321 (* This program computes the sequence as the number of terms in the minimal alternative triangular-number representation of n+1. *)
%t A182321 b[n_] := n (n + 1)/2; bb = Table[b[n], {n, 0, 1000}];
%t A182321 s[n_] := Table[b[n], {k, 1, n}];
%t A182321 h[1] = {1}; h[n_] := Join[h[n - 1], s[n]]; g = h[100]; r[0] = {0};
%t A182321 r[n_] := If[MemberQ[bb, n], {n}, Join[{g[[n]]}, -r[g[[n]] - n]]];
%t A182321 Join[{0}, Rest[Table[Length[r[n]], {n, 0, 100}]]] (* A182321 for n >= 1 *)
%t A182321 (* _Clark Kimberling_, Apr 10 2015 *)
%Y A182321 Cf. A025581, A002024, A255974.
%K A182321 nonn
%O A182321 0,3
%A A182321 _Patrick Devlin_, Apr 24 2012