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.

A338482 Least number of centered triangular numbers that sum to n.

Original entry on oeis.org

1, 2, 3, 1, 2, 3, 4, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 1, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 5, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 4, 2, 3, 4, 5, 3, 4, 2, 3, 1, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5
Offset: 1

Views

Author

Ilya Gutkovskiy, Oct 29 2020

Keywords

Comments

It appears that a(n) = 3 for n == 0 (mod 3), 1 <= a(n) <= 4 for n == 1 (mod 3), and 2 <= a(n) <= 5 for n == 2 (mod 3). - Robert Israel, Nov 13 2020

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; local r,i;
        r:= sqrt(24*n-15)/6+1/2;
        if r::integer then return 1 fi;
        1+min(seq(procname(n-(3*i*(i-1)/2+1)),i=1..floor(r)))
    end proc:
    map(f, [$1..200]); # Robert Israel, Nov 13 2020
  • Mathematica
    f[n_] := f[n] = Module[{r}, r = Sqrt[24n-15]/6+1/2; If[IntegerQ[r], Return[1]]; 1+Min[Table[f[n-(3i*(i-1)/2+1)], {i, 1, Floor[r]}]]];
    Map[f, Range[200]] (* Jean-François Alcover, Sep 16 2022, after Robert Israel *)