A276781 a(n) = 1+n-(nearest power of prime <= n); for n > 1, a(n) = minimal b such that the numbers binomial(n,k) for b <= k <= n-b have a common divisor greater than 1.
1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 3, 1, 1, 2, 1, 2, 3, 4, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 1, 2
Offset: 1
Examples
Row 6 of Pascal's triangle is 1,6,15,20,15,6,1 and [15,20,15] have a common divisor of 5. Since 15 = binomial(6,2), a(6)=2.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..16384 (terms for n = 2..1685 from R. J. Mathar, terms 1686..10000 from Chai Wah Wu).
- Antti Karttunen, Data supplement: n, a(n) computed for n = 1..65537
- Christophe Soulé, Le triangle de Pascal et ses propriétés, Lecture, Soc. Math. de France, Feb 13 2008; SMF link (in French).
Crossrefs
Programs
-
Maple
mygcd:=proc(lis) local i,g,m; m:=nops(lis); g:=lis[1]; for i from 2 to m do g:=gcd(g,lis[i]); od: g; end; f:=proc(n) local b,lis; global mygcd; for b from floor(n/2) by -1 to 1 do lis:=[seq(binomial(n,i),i=b..n-b)]; if mygcd(lis)=1 then break; fi; od: b+1; end; [seq(f(n),n=2..120)];
-
Mathematica
Table[b = 1; While[GCD @@ Map[Binomial[n, #] &, Range[b, n - b]] == 1, b++]; b, {n, 92}] (* Michael De Vlieger, Oct 03 2016 *)
-
PARI
A276781(n) = if(1==n,1,forstep(k=n,1,-1,if(isprimepower(k),return(1+n-k)))); \\ Antti Karttunen, Jan 21 2020
-
Python
from sympy import factorint def A276781(n): return 1+n-next(filter(lambda m:len(factorint(m))<=1, range(n,0,-1))) # Chai Wah Wu, Oct 25 2024
Formula
If A010055(n) == 1, a(n) = 1, otherwise a(n) = 1 + a(n-1). - Antti Karttunen, Jan 21 2020
Extensions
Term a(1) = 1 prepended and alternative simpler definition added to the name by Antti Karttunen, Jan 20 2020
Comments