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.

A280053 "Nachos" sequence based on squares.

This page as a plain text file.
%I A280053 #36 Mar 16 2023 06:44:48
%S A280053 1,2,3,4,1,2,3,4,5,2,3,4,5,1,2,3,4,5,2,3,4,5,6,3,4,5,6,2,3,1,2,3,4,5,
%T A280053 2,3,4,5,6,3,4,5,6,2,3,4,5,6,3,4,5,6,7,4,1,2,3,4,5,2,3,4,5,6,3,4,5,6,
%U A280053 2,3,4,5,6,3,4,5,6,7,4,5,6,7,3,4,2,3,4,5,6,3
%N A280053 "Nachos" sequence based on squares.
%C A280053 The nachos sequence based on a sequence of positive numbers S starting with 1 is defined as follows: To find a(n) we start with a pile of n nachos.
%C A280053 During each phase, we successively remove S(1), then S(2), then S(3), ..., then S(i) nachos from the pile until fewer than S(i+1) remain. Then we start a new phase, successively removing S(1), then S(2), ..., then S(j) nachos from the pile until fewer than S(j+1) remain. Repeat. a(n) is the number of phases required to empty the pile.
%C A280053 Suggested by the Fibonachos sequence A280521, which is the case when S is 1,1,2,3,5,8,13,... (A000045).
%C A280053 If S = 1,2,3,4,5,... we get A057945.
%C A280053 If S = 1,2,3,5,7,11,... (A008578) we get A280055.
%C A280053 If S = triangular numbers we get A281367.
%C A280053 If S = squares we get the present sequence.
%C A280053 If S = powers of 2 we get A100661.
%C A280053 Needs a more professional Maple program.
%C A280053 Comment from _Matthew C. Russell_, Jan 30 2017 (Start):
%C A280053 Theorem: Any nachos sequence based on a sequence S = {1=s1 < s2 < s3 < ...} is unbounded.
%C A280053 Proof: S is the (infinite) set of numbers that we are allowed to subtract. (In the case of Fibonachos, this is the set of Fibonaccis themselves, not the partial sums.)
%C A280053 Suppose that n is a positive integer, with the number of stages of the process denoted by a(n).
%C A280053 Let s_m be the smallest element of S that is greater than n.
%C A280053 Then, if you start the process at N = n + s1 + s2 + s3 + ... + s_(m-1), you will get stuck when you hit n, and will have to start the process over again. Thus you will take a(n) + 1 stages of the process here, so a(N) = a(n) + 1.
%C A280053 (End)
%H A280053 Lars Blomberg, <a href="/A280053/b280053.txt">Table of n, a(n) for n = 1..10000</a>
%H A280053 Reddit user Teblefer, <a href="https://www.reddit.com/r/math/comments/5lxh3c">Fibonachos</a>
%e A280053 If n = 10, in the first phase we successively remove 1, then 4 nachos, leaving 5 in the pile. The next square is 9, which is bigger than 5, so we start a new phase. We remove 1, then 4 nachos, and now the pile is empty. There were two phases, so a(10)=2.
%p A280053 S:=[seq(i^2,i=1..1000)];
%p A280053 phases := proc(n) global S; local a,h,i,j,ipass;
%p A280053 a:=1; h:=n;
%p A280053 for ipass from 1 to 100 do
%p A280053    for i from 1 to 100 do
%p A280053       j:=S[i];
%p A280053       if j>h then a:=a+1; break; fi;
%p A280053       h:=h-j;
%p A280053       if h=0 then return(a); fi;
%p A280053                        od;
%p A280053 od;
%p A280053 return(-1);
%p A280053 end;
%p A280053 t1:=[seq(phases(i),i=1..1000)];
%p A280053 # 2nd program
%p A280053 A280053 := proc(n)
%p A280053     local a,nres,i ;
%p A280053     a := 0 ;
%p A280053     nres := n;
%p A280053     while nres > 0 do
%p A280053         for i from 1 do
%p A280053             if A000330(i) > nres then
%p A280053                 break;
%p A280053             end if;
%p A280053         end do:
%p A280053         nres := nres-A000330(i-1) ;
%p A280053         a := a+1 ;
%p A280053     end do:
%p A280053     a ;
%p A280053 end proc:
%p A280053 seq(A280053(n),n=1..80) ; # _R. J. Mathar_, Mar 05 2017
%t A280053 A280053[n_] := Module[{a, nres, i}, a = 0; nres = n; While[nres > 0, For[i = 1, True, i++, If[i(i+1)(2i+1)/6 > nres, Break[]]]; nres = nres - i(i-1)(2i-1)/6; a++]; a];
%t A280053 Table[A280053[n], {n, 1, 90}] (* _Jean-François Alcover_, Mar 16 2023, after _R. J. Mathar_ *)
%Y A280053 Cf. A000045, A008578, A280521, A057945, A281367, A100661, A280055.
%Y A280053 For indices of first occurrences of 1,2,3,4,... see A280054.
%K A280053 nonn
%O A280053 1,2
%A A280053 _N. J. A. Sloane_, Jan 07 2017