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-2 of 2 results.

A242923 Lexicographically least sequence over the positive integers with the property that there are no two consecutive blocks of the same length and same sum.

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 1, 4, 2, 1, 2, 5, 2, 1, 3, 1, 2, 1, 3, 4, 1, 2, 1, 7, 2, 3, 1, 2, 1, 5, 1, 2, 1, 8, 2, 4, 2, 3, 2, 1, 5, 4, 3, 7, 2, 1, 4, 2, 5, 3, 1, 2, 1, 3, 4, 1, 2, 1, 4, 5, 3, 2, 1, 7, 4, 6, 2, 6, 3, 6, 1, 6, 2, 3, 2, 1, 2, 8, 3, 1, 2, 1, 3, 1, 2, 7, 1
Offset: 1

Views

Author

Jeffrey Shallit, May 26 2014

Keywords

Crossrefs

First difference of A242921.
Cf. A191818.

Programs

  • Maple
    b:= proc(n) option remember; local i, t, ok;
          if n<2 then n
        else for t from 1+b(n-1) do ok:=true;
               for i to n/2 while ok
                 do ok:=b(n-2*i)+t <> 2*b(n-i) od;
               if ok then return t fi
             od
          fi
        end:
    a:= n-> b(n) -b(n-1):
    seq(a(n), n=1..120);  # Alois P. Heinz, May 26 2014
  • Mathematica
    b[n_] := b[n] = Module[{i, t, ok}, If[n<2, n, For[t = 1+b[n-1], True, t++, ok = True; For[i = 1, i <= n/2 && ok, i++, ok = b[n-2i] + t != 2b[n-i]]; If[ok, Return[t]]]]];
    a[n_] := b[n] - b[n-1];
    Array[a, 120] (* Jean-François Alcover, Nov 13 2020, after Alois P. Heinz *)

Formula

a(9) = 2 because choosing a(9) = 1 gives the blocks (3,1,2) and (1,4,1), which are both of length 3 and sum to 6.

A242924 Position of first occurrence of n in A242923.

Original entry on oeis.org

1, 2, 4, 8, 12, 66, 24, 34, 233, 251, 284, 173, 104, 299, 329, 431, 596, 625, 528, 1052, 759, 349, 667, 1028, 793, 436, 1242, 1882, 1410, 1374, 4974, 1181, 3626, 3517, 3673, 3148, 4398, 6160, 5537, 4254, 5512, 7039, 4074, 2194, 10206, 11361, 4154, 12710, 7559
Offset: 1

Views

Author

Jeffrey Shallit, May 26 2014

Keywords

Comments

Not currently known to be finite for all n.

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; local i, t, ok;
          if n<2 then n
        else for t from 1 +b(n-1) do ok:=true;
               for i to n/2 while ok
                 do ok:= b(n-2*i)+t <> 2*b(n-i) od;
               if ok then return t fi
             od
          fi
        end:
    a:= proc() local t, a; t, a:= 0, proc() 0 end;
          proc(n) local h;
            while a(n) = 0 do
              t:= t+1; h:= b(t) -b(t-1);
              if a(h) = 0 then a(h):= t fi
            od; a(n)
          end
        end():
    seq(a(n), n=1..30);  # Alois P. Heinz, May 26 2014
  • Mathematica
    nmaxb = 2000; (* max index of b(n) *)
    nmaxa = 30; (* max index of a(n) *)
    b[n_] := b[n] = Module[{i, t, ok}, If[n < 2, n, For[t = 1 + b[n - 1], True, t++, ok = True; For[i = 1, i <= n/2 && ok, i++, ok = b[n - 2 i] + t != 2 b[n - i]]; If[ok, Return[t]]]]];
    B = Array[b, nmaxb] // Differences;
    a[n_] := a[n] = Module[{p = FirstPosition[B, n]}, Which[n == 1, 1, p === Missing["NotFound"], -1, True, p[[1]] + 1]];
    Array[a, nmaxa] (* Jean-François Alcover, Nov 23 2020, after Alois P. Heinz for b(n) *)
Showing 1-2 of 2 results.