login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A281367 "Nachos" sequence based on triangular numbers. 4
1, 2, 3, 1, 2, 3, 4, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 4, 5, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 2, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 2, 3, 4, 5, 3, 4, 5, 6, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 4, 5, 3, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
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.
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.
Suggested by the Fibonachos sequence A280521, which is the case when S is 1,1,2,3,5,8,13,... (A000045).
If S = 1,2,3,4,5,... we get A057945.
If S = 1,2,3,5,7,11,... (A008578) we get A280055.
If S = triangular numbers we get the present sequence.
If S = squares we get A280053.
If S = powers of 2 we get A100661.
More than the usual number of terms are shown in order to distinguish this sequence from A104246.
LINKS
Reddit user Teblefer, Fibonachos
EXAMPLE
If n = 14, in the first phase we successively remove 1, then 3, then 6 nachos, leaving 4 in the pile. The next triangular number is 10, which is bigger than 4, so we start a new phase. We remove 1, then 3 nachos, and now the pile is empty. There were two phases, so a(14)=2.
MAPLE
S:=[seq(i*(i+1)/2, i=1..1000)];
phases := proc(n) global S; local a, h, i, j, ipass;
a:=1; h:=n;
for ipass from 1 to 100 do
for i from 1 to 100 do
j:=S[i];
if j>h then a:=a+1; break; fi;
h:=h-j;
if h=0 then return(a); fi;
od;
od;
return(-1);
end;
t1:=[seq(phases(i), i=1..1000)];
# 2nd program
A281367 := proc(n)
local a, nres, i ;
a := 0 ;
nres := n;
while nres > 0 do
for i from 1 do
if A000292(i) > nres then
break;
end if;
end do:
nres := nres-A000292(i-1) ;
a := a+1 ;
end do:
a ;
end proc:
seq(A281367(n), n=1..80) ; # R. J. Mathar, Mar 05 2017
MATHEMATICA
tri[n_] := n (n + 1) (n + 2)/6;
A281367[n_] := Module[{a = 0, nres = n, i}, While[nres > 0, For[i = 1, True, i++, If[tri[i] > nres, Break[]]]; nres -= tri[i-1]; a++]; a];
Table[A281367[n], {n, 1, 99}] (* Jean-François Alcover, Apr 11 2024, after R. J. Mathar *)
CROSSREFS
For indices of first occurrences of 1,2,3,4,... see A281368.
Different from A104246.
Sequence in context: A264031 A338482 A104246 * A007720 A129968 A027615
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jan 30 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 13:27 EDT 2024. Contains 371971 sequences. (Running on oeis4.)