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.

Showing 1-5 of 5 results.

A280053 "Nachos" sequence based on squares.

Original entry on oeis.org

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, 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, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 5, 6, 7, 3, 4, 2, 3, 4, 5, 6, 3
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2017

Keywords

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 A281367.
If S = squares we get the present sequence.
If S = powers of 2 we get A100661.
Needs a more professional Maple program.
Comment from Matthew C. Russell, Jan 30 2017 (Start):
Theorem: Any nachos sequence based on a sequence S = {1=s1 < s2 < s3 < ...} is unbounded.
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.)
Suppose that n is a positive integer, with the number of stages of the process denoted by a(n).
Let s_m be the smallest element of S that is greater than n.
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.
(End)

Examples

			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.
		

Crossrefs

For indices of first occurrences of 1,2,3,4,... see A280054.

Programs

  • Maple
    S:=[seq(i^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
    A280053 := proc(n)
        local a,nres,i ;
        a := 0 ;
        nres := n;
        while nres > 0 do
            for i from 1 do
                if A000330(i) > nres then
                    break;
                end if;
            end do:
            nres := nres-A000330(i-1) ;
            a := a+1 ;
        end do:
        a ;
    end proc:
    seq(A280053(n),n=1..80) ; # R. J. Mathar, Mar 05 2017
  • Mathematica
    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];
    Table[A280053[n], {n, 1, 90}] (* Jean-François Alcover, Mar 16 2023, after R. J. Mathar *)

A281367 "Nachos" sequence based on triangular numbers.

Original entry on oeis.org

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
Offset: 1

Views

Author

N. J. A. Sloane, Jan 30 2017

Keywords

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.

Examples

			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.
		

Crossrefs

For indices of first occurrences of 1,2,3,4,... see A281368.
Different from A104246.

Programs

  • 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 *)

A101387 Quet transform of A002260.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 5, 1, 1, 7, 1, 2, 1, 9, 1, 3, 1, 12, 1, 1, 4, 1, 15, 1, 2, 1, 5, 1, 18, 1, 3, 1, 7, 1, 1, 21, 1, 4, 1, 9, 1, 2, 1, 24, 1, 5, 1, 11, 1, 3, 1, 28, 1, 1, 6, 1, 13, 1, 4, 1, 32, 1, 2, 1, 7, 1, 15, 1, 5, 1, 36, 1, 3, 1, 9, 1, 1, 17, 1, 6, 1, 40, 1, 4, 1, 11, 1, 2, 1, 19, 1, 7, 1, 44, 1, 5, 1
Offset: 1

Views

Author

David Wasserman, Jan 14 2005

Keywords

Comments

The Quet transform converts any sequence of positive integers containing an infinite number of 1's into another sequence of positive integers containing an infinite number of 1's.
Start with a sequence, {a(k)}, of only positive integers and an infinite number of 1's. Example: 1,1,2,1,2,3,1,2,3,4,1,... (A002260).
Form the sequence {b(k)} (which is a permutation of the positive integers), given by b(k) = the a(k)th smallest positive integer not yet in the sequence b, with b(1)=a(1).
In the example b is 1,2,4,3,6,8,5,9,11,13,7,12,15,... (A065562).
Let {c(k)} be the inverse of {b(k)}. In the example c = 1,2,4,3,7,5,11,6,8,16,9,12... (A065579).
Form the final sequence {d(k)}, where each d(k) is such that c(k) = the d(k)th smallest positive integer not yet in the sequence c, with d(1)=c(1).
In the example d is 1,1,2,1,3,1,5,1,1,7,1,2,1,9,1,3,1,12,1,1,4,1,15,... (the current sequence).
A more formal description of the Quet transform is as follows.
Let N denote the positive integers. For any permutation p: N -> N, let T(p): N -> N be given by T(p)(n) = # of elements in {m in N | m >= n AND p(m) <= p(n)}. Observe that T is a bijection from the set of permutations N -> N onto the set of sequences N -> N that contain infinitely many 1's.
Now suppose f: N -> N contains infinitely many 1's; then its Quet transform Q(f): N -> N is T^(-1)[(T(f))^(-1)], which also contains infinitely many 1's. Q is self-inverse; f and Q(f) correspond via T to a permutation and its inverse.

Crossrefs

Programs

  • PARI
    \\ PARI code to compute the Quet transform.  Put the first n terms of the sequence
    \\ into a vector v; then Q(v) returns the transformed sequence.  The output is a
    \\ vector, containing as many terms as can be computed from the given data.
    TInverse(v) = local(l, w, used, start, x); l = length(v); w = vector(l); used = vector(l); start = 1; for (i = 1, l, while (start <= l && used[start], start++); x = start; for (j = 2, v[i], x++; while (x <= l && used[x], x++)); if (x > l, return (vector(i - 1, k, w[k])), w[i] = x; used[x] = 1)); w;
    PInverse(v) = local(l, w); l = length(v); w = vector(l); for (i = 1, l, if (v[i] <= l, w[v[i]] = i)); w;
    T(v) = local(l, w, c); l = length(v); w = vector(l); for (n = 1, l, if (v[n], c = 0; for (m = 1, n - 1, if (v[m] < v[n], c++)); w[n] = v[n] - c, return (vector(n - 1, i, w[i])))); w;
    Q(v) = T(PInverse(TInverse(v)));
    \\ David Wasserman, Jan 14 2005

A100808 Quet transform (see A101387 for definition) of Kolakoski sequence A000002.

Original entry on oeis.org

1, 3, 1, 1, 1, 2, 1, 3, 1, 1, 3, 1, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 3, 1, 1, 1, 2, 1, 1, 2, 1, 3, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 1, 3, 1, 1, 1, 2, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 3, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 1, 3, 1, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2
Offset: 1

Views

Author

David Wasserman, Jan 12 2005

Keywords

Comments

Can be obtained from A000002 by replacing each 2,2 with 3,1.

Crossrefs

A336748 a(n) is the smallest number that is the sum of at least n repdigits (not necessarily distinct) but not of any fewer.

Original entry on oeis.org

1, 10, 21, 320, 2219, 32218, 332217, 3332216, 33332215, 333332214, 3333332213
Offset: 1

Views

Author

Falcon Shapiro, Aug 02 2020

Keywords

Comments

I believe the sequence is infinite.
a(10) exists and is <= 333332214.

Examples

			1      is the sum of 1 repdigit: 1;
10     is the sum of 2 repdigits: 9      + 1;
21     is the sum of 3 repdigits: 11     + 9     + 1;
320    is the sum of 4 repdigits: 222    + 88    + 9    + 1;
2219   is the sum of 5 repdigits: 1111   + 999   + 99   + 9   + 1;
32218  is the sum of 6 repdigits: 22222  + 8888  + 999  + 99  + 9  + 1;
332217 is the sum of 7 repdigits: 222222 + 99999 + 8888 + 999 + 99 + 9 + 1.
All numbers less than 10 can be summed with less than 2 repdigits.
All numbers less than 21 can be summed with less than 3 repdigits. etc.
		

Crossrefs

Cf. A000325 (binary analog, see A100661), A010785.

Extensions

a(8) from Jinyuan Wang, Aug 03 2020
a(9) from David A. Corneth, Aug 03 2020
a(10)-a(11) from Rémy Sigrist, Aug 25 2022
Showing 1-5 of 5 results.