login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A317650 The n-th term is the smallest integer > 1 that is congruent to +1 or -1 modulo k for all 2 <= k <= n. 0
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

2,1

LINKS

Table of n, a(n) for n=2..33.

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

PROG

(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(t<m && ok(n, t), m=t)); m} \\ Andrew Howroyd, Aug 02 2018

CROSSREFS

Sequence in context: A164663 A098971 A093572 * A240731 A266505 A118132

Adjacent sequences:  A317647 A317648 A317649 * A317651 A317652 A317653

KEYWORD

nonn

AUTHOR

Kevin D. Woerner, Aug 02 2018

EXTENSIONS

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

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 12:38 EDT 2021. Contains 343650 sequences. (Running on oeis4.)