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.

Showing 1-3 of 3 results.

A249441 a(n) is the smallest prime whose square divides at least one entry in the n-th row of Pascal's triangle, or 0 if there is no such prime.

Original entry on oeis.org

0, 0, 0, 0, 2, 0, 2, 0, 2, 2, 2, 0, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 0

Views

Author

Vladimir Shevelev, Oct 28 2014

Keywords

Comments

a(n) = 3 for 15, 31, 47, 63, 95, 127, 191, 255, 383, 511, 767, 1023, 1535, 2047, 3071, etc.
The above values all occur in A249723 and from 31 onward seem to be given by A052955(n>=8). (Cf. also A249714 & A249715). - Antti Karttunen, Nov 04 2014
Using the Kummer theorem on carries, one can prove that, if a(n)>3 or 0, then n>23 takes the form of either 1...1 or 101...1 in base 2 and simultaneously 212...2 in base 3. However, it is easy to see that this leads to a contradiction. Thus there are no terms greater than 3 and only 8 zeros, i.e., there are only 8 rows in Pascal's triangle that contain all squarefree numbers. It turns out that the latter result has been known for a long time (see A048278).

Crossrefs

Programs

  • Maple
    a_list := proc(len) local s; s := proc(L,p) local n; seq(max(op(map(b-> padic[ordp](b,p),{seq(binomial(n,k),k=0..n)}))),n=0..L); map(k-> `if`(k<2,0,p),[%]) end: zip((x,y)-> `if`(x=0,y,x),s(len,2),s(len,3)) end: a_list(86); # Peter Luschny, Nov 01 2014
    # alternative
    A249441 := proc(n)
        local p,wrks,bi,k;
        if n in [0,1,2,3,5,7,11,23] then
            return 0 ;
        end if;
        p :=2 ;
        while true do
            wrks := false;
            bi := 1 ;
            for k from 0 to n do
                if modp(bi,p^2) = 0 then
                    wrks := true;
                    break;
                end if;
                bi := bi*(n-k)/(1+k) ;
            end do:
            if wrks then
                return p;
            end if;
            p := nextprime(p) ;
        end do:
    end proc: # R. J. Mathar, Nov 04 2014
  • Mathematica
    row[n_] := Table[Binomial[n, k], {k, 1, (n-Mod[n, 2])/2}];
    a[n_] := If[MemberQ[{0, 1, 2, 3, 5, 7, 11, 23}, n], 0, For[p = 2, True, p = NextPrime[p], If[AnyTrue[row[n], Divisible[#, p^2]&], Return[p]]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jul 30 2018 *)
  • PARI
    a(n) = my(o=0); for(k=1,n\2, o+=valuation((n-k+1)/k, 2); if(o>1, return(2))); if(n<24 && n!=15, 0, 3) \\ Charles R Greathouse IV, Nov 03 2014
    
  • PARI
    A249441(n) = { forprime(p=2,3,for(k=0,n\2,if((0==(binomial(n,k)%(p*p))),return(p)))); return(0); } \\ This is more straightforward, but a slower implementation - Antti Karttunen, Nov 03 2014
    
  • PARI
    a(n)=if((n+1)>>valuation(n+1,2)<5, if(n<24 && setsearch([1,2,3,5,7,11,23],n), 0, 3), 2) \\ Charles R Greathouse IV, Nov 06 2014

Extensions

More terms from Peter J. C. Moses, Oct 28 2014

A249695 a(n)=0, if A249441(n)=0; otherwise, a(n) is the smallest i such that A249441(n)^2 divides binomial(n,i).

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 3, 0, 1, 2, 3, 0, 1, 6, 3, 7, 1, 2, 3, 4, 1, 6, 3, 0, 1, 2, 3, 12, 1, 6, 3, 5, 1, 2, 3, 4, 1, 6, 3, 8, 1, 2, 3, 12, 1, 6, 3, 21, 1, 2, 3, 4, 1, 6, 3, 24, 1, 2, 3, 12, 1, 6, 3, 1, 1, 2, 3, 4, 1, 6, 3, 8, 1, 2, 3, 12, 1, 6, 3, 16, 1, 2, 3, 4, 1, 6, 3
Offset: 0

Views

Author

Vladimir Shevelev, Nov 04 2014

Keywords

Comments

After a(0) = 0, A048278 gives the positions of seven other zeros in the sequence. - Antti Karttunen, Nov 04 2014

Crossrefs

A249714 and A249715 give the record values and their positions.
Differs from A249442 for the first time at n=9.

Programs

  • Maple
    A249695 := proc(n)
        a41n := A249441(n) ;
        if a41n = 0 then
            return 0;
        end if;
        bi := 1;
        for i from 0 do
            if modp(bi,a41n^2)= 0 then
                return i;
            end if;
            bi := bi*(n-i)/(1+i) ;
        end do:
    end proc: # R. J. Mathar, Nov 04 2014
  • Mathematica
    bb[n_] := Table[Binomial[n, k], {k, 1, (n - Mod[n, 2])/2}];
    a41[n_] := If[MemberQ[{0, 1, 2, 3, 5, 7, 11, 23}, n], 0, For[p = 2, True, p = NextPrime[p], If[AnyTrue[bb[n], Divisible[#, p^2]&], Return[p]]]];
    a[n_] := If[(a41n = a41[n]) == 0, 0, For[i = 1, True, i++, If[Divisible[ Binomial[n, i], a41n^2], Return[i]]]];
    a /@ Range[0, 100] (* Jean-François Alcover, Mar 27 2020 *)
  • PARI
    A249695(n) = { forprime(p=2,3,for(k=0,floor(n/2),if((0==(binomial(n,k)%(p*p))),return(k)))); return(0); } \\ Straightforward and unoptimized version. But fast enough for 10000 terms.
    A249695(n) = { for(p=2,3, my(o=0); for(k=1, n\2, o+=valuation((n-k+1)/k, p); if(o>1, return(k)))); return(0); } \\ This version is based on Charles R Greathouse IV's code for A249441.
    for(n=0, 10000, write("b249695.txt", n, " ", A249695(n)));
    \\ Antti Karttunen, Nov 04 2014

A249715 Positions of records in A249695.

Original entry on oeis.org

0, 4, 6, 13, 15, 27, 47, 55, 111, 223, 447, 895, 1791, 3583, 7167, 14335, 28671, 57343, 114687, 229375, 458751, 917503, 1835007, 3670015, 7340031, 14680063, 29360127, 58720255, 117440511
Offset: 1

Views

Author

Keywords

Comments

From n=8 [a(8)=55] onward, the terms seem to be given by A086224(n-5), i.e. as (7 * 2^(n-5)) - 1.

Crossrefs

A249714 gives the corresponding record values.
Showing 1-3 of 3 results.