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.

A242410 a(1)=1 and for n>1, a(n) is the smallest number greater than a(n-1) such that a(n) is not divisible by a(d) for any divisor d of n (except 1 and n).

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 31, 33, 34, 37, 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 57, 58, 59, 60, 61, 62, 63, 64, 67, 68, 71, 73, 77, 79, 81, 82, 83, 84
Offset: 1

Views

Author

J. Lowell, May 13 2014

Keywords

Comments

Contains the primes (A000040). - Robert Israel, Jul 05 2017

Examples

			a(4) cannot be 4 because 4 is divisible by a(2) = 2. a(24) cannot be 25 because 25 is divisible by a(4) = 5.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; local Q,k;
         Q:= map(procname, numtheory:-divisors(n) minus {1,n});
         for k from procname(n-1) + 1 do
           if andmap(t -> (k mod t > 0), Q) then return k fi
         od
    end proc:
    f(1):= 1:
    map(f, [$1..100]); # Robert Israel, Jul 05 2017
  • Mathematica
    a = {1}; Do[k = a[[n - 1]] + 1; While[AnyTrue[Most@ Rest@ Divisors@ n, Divisible[k, a[[#]] ] &], k++]; AppendTo[a, k], {n, 2, 61}]; a (* Michael De Vlieger, Jul 05 2017 *)
  • PARI
    okd(k, vd) = {for (i=1, #vd, if ((k % vd[i]) == 0, return (0));); return (1);}
    fnext(n, va) = {d = divisors(n); vd = vector(#d-2, i, va[d[i+1]]); k = va[n-1]+1; while (! okd(k, vd), k++); k;}
    lista(nn) = {va = vector(nn); va[1] = 1; for (n=2, nn, va[n] = fnext(n, va);); va;} \\ Michel Marcus, May 17 2014