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.

A317650 The n-th term is the smallest integer > 1 that is congruent to +1 or -1 modulo k for all 2 <= k <= n.

Original entry on oeis.org

3, 5, 5, 11, 11, 29, 41, 71, 71, 881, 1079, 10009, 10009, 32759, 82081, 636481, 636481, 2162161, 2162161, 2162161, 2162161, 39412801, 39412801, 39412801, 39412801, 1074427199, 1074427199, 15362146799, 15362146799, 109271408401, 482955026399, 482955026399
Offset: 2

Views

Author

Kevin D. Woerner, Aug 02 2018

Keywords

Programs

  • Mathematica
    Rest@ Nest[Function[a, Append[a, Block[{k = a[[-1]]}, While[! AllTrue[Table[Or[# == 1, # == m - 1] &@ Mod[k, m], {m, Length@ a + 1}], # &], k++]; k]]], {2}, 16] (* Michael De Vlieger, Aug 02 2018 *)
  • PARI
    ok(n,m)={for(i=2, n, my(r=m%i); if(r<>1&&r<>i-1, return(0))); 1}
    a(n)={my(m=oo, p=primes(primepi(n))); p=vector(#p, i, p[i]^logint(n, p[i]));
    for(k=0, 2^#p-1, my(t=2+lift(-2+chinese(vector(#p, i, Mod(if(bittest(k, i-1), -1, 1), p[i]))))); if(tAndrew Howroyd, Aug 02 2018

Extensions

a(21)-a(32) from Andrew Howroyd, Aug 02 2018