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.

A332558 a(n) is the smallest k such that n*(n+1)*(n+2)*...*(n+k) is divisible by n+k+1.

Original entry on oeis.org

4, 3, 2, 3, 4, 5, 4, 3, 5, 4, 6, 5, 6, 5, 4, 7, 6, 5, 4, 3, 6, 7, 6, 5, 4, 8, 7, 6, 6, 5, 8, 7, 6, 5, 4, 8, 7, 6, 5, 7, 6, 5, 10, 9, 8, 9, 8, 7, 6, 9, 8, 7, 6, 5, 4, 6, 12, 11, 10, 9, 8, 7, 6, 7, 6, 5, 12, 11, 10, 9, 8, 7, 6, 5, 8, 7, 6, 11, 10, 9, 8, 7, 6, 5
Offset: 1

Views

Author

Keywords

Comments

This is a multiplicative analog of A332542.
a(n) always exists because one can take k to be 2^m - 1 for m large.

Crossrefs

Cf. A061836 (k+1), A332559 (n+k+1), A332560 (the final product), A332561 (the quotient).
For records, see A333532 and A333533 (and A333537), which give the records in the essentially identical sequence A061836.
Additive version: A332542, A332543, A332544, A081123.
"Concatenate in base 10" version: A332580, A332584, A332585.

Programs

  • Maple
    f:= proc(n) local k,p;
      p:= n;
      for k from 1 do
        p:= p*(n+k);
        if (p/(n+k+1))::integer then return k fi
      od
    end proc:
    map(f, [$1..100]); # Robert Israel, Feb 25 2020
  • Mathematica
    a[n_] := Module[{k, p = n}, For[k = 1, True, k++, p *= (n+k); If[Divisible[p, n+k+1], Return[k]]]];
    Array[a, 100] (* Jean-François Alcover, Jun 04 2020, after Maple *)
  • PARI
    a(n) = {my(r=n*(n+1)); for(k=2, oo, r=r*(n+k); if(r%(n+k+1)==0, return(k))); } \\ Jinyuan Wang, Feb 25 2020
    
  • PARI
    \\ See Corneth link
    
  • Python
    def a(n):
        k, p = 1, n*(n+1)
        while p%(n+k+1): k += 1; p *= (n+k)
        return k
    print([a(n) for n in range(1, 85)]) # Michael S. Branicky, Jun 06 2021

Formula

a(n) = A061836(n) - 1 for n >= 1.
a(n + 1) >= a(n) - 1. a(n + 1) = a(n) - 1 mostly. - David A. Corneth, Apr 14 2020

A332542 a(n) is the smallest k such that n+(n+1)+(n+2)+...+(n+k) is divisible by n+k+1.

Original entry on oeis.org

2, 7, 14, 3, 6, 47, 14, 4, 10, 20, 25, 11, 5, 31, 254, 15, 18, 55, 6, 10, 22, 44, 14, 23, 11, 7, 86, 27, 30, 959, 62, 16, 34, 8, 73, 35, 17, 24, 163, 39, 42, 127, 9, 22, 46, 92, 62, 19, 23, 15, 158, 51, 10, 20, 75, 28, 58, 116, 121, 59, 29, 127, 254, 11
Offset: 3

Views

Author

Scott R. Shannon, Feb 18 2020

Keywords

Comments

Note that (n+(n+1)+(n+2)+...+(n+k))/(n+k+1) = A332544(n)/(n+k+1) = A082183(n-1). See the Myers et al. link for proof. - N. J. A. Sloane, Apr 30 2020
We can always take k = n^2-2*n-1, for then the sum in the definition becomes (n+1)*n*(n-1)*(n-2)/2, which is an integral multiple of n+k+1 = n*(n-1). So a(n) always exists. - N. J. A. Sloane, Feb 20 2020

Examples

			n=4: we get 4 -> 4+5=9 -> 9+6=15 -> 15+7=22 -> 22+8=30 -> 30+9=39 -> 39+10=49 -> 49+11=60, which is divisible by 12, and took k=7 steps, so a(4) = 7. Also A332543(4) = 12, A332544(4) = 60, and A082183(3) = 60/12 = 5.
		

Crossrefs

See A332558-A332561 for a multiplicative analog.

Programs

  • Maple
    grow2 := proc(n,M) local p,q,k; # searches out to a limit of M
    # returns n, k (A332542(n)), n+k+1 (A332543(n)), p (A332544(n)), and q (which appears to match A082183(n-1))
    for k from 1 to M do
       if ((k+1)*n + k*(k+1)/2) mod (n+k+1) = 0 then
       p := (k+1)*n+k*(k+1)/2;
       q := p/(n+k+1); return([n,k,n+k+1,p,q]);
       fi;
    od:
    # if no success, return -1's
    [n,-1,-1,-1,-1]; end; # N. J. A. Sloane, Feb 18 2020
  • Mathematica
    a[n_] := NestWhile[#1+1&,0,!IntegerQ[Divide[(#+1)*n+#*(#+1)/2,n+#+1]]&]
    a/@Range[3,100] (* Bradley Klee, Apr 30 2020 *)
  • PARI
    a(n) = my(k=1); while (sum(i=0, k, n+i) % (n+k+1), k++); k; \\ Michel Marcus, Aug 26 2021
    
  • Python
    def a(n):
        k, s = 1, 2*n+1
        while s%(n+k+1) != 0: k += 1; s += n+k
        return k
    print([a(n) for n in range(3, 67)]) # Michael S. Branicky, Aug 26 2021
  • Ruby
    def A(n)
      s = n
      t = n + 1
      while s % t > 0
        s += t
        t += 1
      end
      t - n - 1
    end
    def A332542(n)
      (3..n).map{|i| A(i)}
    end
    p A332542(100) # Seiichi Manyama, Feb 19 2020
    

A332543 a(n) = n + A332542(n) + 1.

Original entry on oeis.org

6, 12, 20, 10, 14, 56, 24, 15, 22, 33, 39, 26, 21, 48, 272, 34, 38, 76, 28, 33, 46, 69, 40, 50, 39, 36, 116, 58, 62, 992, 96, 51, 70, 45, 111, 74, 57, 65, 205, 82, 86, 172, 55, 69, 94, 141, 112, 70, 75, 68, 212, 106, 66, 77, 133, 87, 118, 177, 183, 122
Offset: 3

Views

Author

Scott R. Shannon, Feb 18 2020

Keywords

Comments

Note that A332542 is well-defined for all n. - N. J. A. Sloane, Feb 20 2020

Examples

			See A332542.
		

Crossrefs

Programs

Showing 1-3 of 3 results.