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.

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