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-4 of 4 results.

A187824 a(n) is the largest m such that n is congruent to -1, 0 or 1 mod k for all k from 1 to m.

Original entry on oeis.org

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

Views

Author

Kival Ngaokrajang, Dec 27 2012

Keywords

Comments

This sequence and A187771 and A187761 are winners in the contest held at the 2013 AMS/MAA Joint Mathematics Meetings. - T. D. Noe, Jan 14 2013
If n = t!-1 then a(n) >= t, so sequence is unbounded. - N. J. A. Sloane, Dec 30 2012
First occurrence of k = 3, 4, 5, ...: 2, 3, 4, 5, 29, 41, 55, 71, 881, 791, 9360, 10009, 1079, 30239, (17 unknown), 246960, (19 unknown), 636481, 1360800, 3160079, (23 unknown), 2162161, 266615999, 39412801 (27 unknown), 107881201, ... Searched up to 3*10^9. - Robert G. Wilson v, Dec 31 2012

Examples

			For n = 6, a(6) = 3 as follows.
m    Residue of 6 (mod m)
1             0
2             0
3             0
4             2
5             1
6             0
7            -1
		

Crossrefs

For values of n which set a new record see A220891.
For smallest inverse see A220890 and A056697.

Programs

  • Maple
    A187824:= proc(n)
       local j,r;
       for j from 4 do
         r:= mods(n, j);
         if r <> r^3 then return j-1 end if
       end do
    end proc; # Robert Israel, Dec 31 2012
  • Mathematica
    f[n_] := Block[{k = 4, r}, While[r = Mod[n, k]; r < 2 || k - r < 2, k++]; k - 1]; Array[f, 101, 2] (* Robert G. Wilson v, Dec 31 2012 *)
  • PARI
    A187824(n)={n++>2 && for(k=4,oo, n%k>2 && return(k-1))} \\ M. F. Hasler, Dec 31 2012, minor edits Aug 20 2020
    
  • PARI
    a(n)=my(k=3);n++;while(n%k++<3,);k-1 \\ Charles R Greathouse IV, Jan 02 2013
    
  • Python
    from gmpy2 import t_mod
    def A187824(n):
        k = 1
        while t_mod(n+1,k) < 3:
            k += 1
        return k-1 # Chai Wah Wu, Aug 31 2014
    
  • Python
    def a(n):
       m=1
       while abs(n%m) < 2:
          m += 1
       return m
    [a(n) for n in range(1,100)]
    # Derek Orr, Aug 31 2014, corrected & edited by M. F. Hasler, Aug 20 2020

Formula

If n == 0 (mod 20), then a(n-2) = a(n+2) = 3, while a(n) = 5,5,6, 5,5,8, 5,5,6, 5,5,6, 5,5,7, 5,5,6, 5,5,7, ... with records a(20) = 5, a(60) = 6, a(120) = 8, a(720) = 10, a(2520) = 12, a(9360) = 13, ... If n == 0 (mod 5), but is not a multiple of 20, then always a(n-2) = a(n+2) = 4, while a(n) = 6,3,5, 6,3,7, 5,3,9, 6,3,5, 7,3,6, 5,3,6, 7,3,5, ... - Vladimir Shevelev, Dec 31 2012
a(n)=3 iff n == 2 (mod 4). a(n)=4 iff n == 3, 7, 8, 12, 13, 17 (mod 20), i.e., n == 2 or 3 (mod 5) but not n == 2 (mod 4). In the same way one can obtain a covering set for any value taken by a(n), this is actually nothing else than the definition. For example, n == 2, 3 or 4 (mod 6) but not 2 or 3 (mod 5) nor 2 (mod 4) yields a(n)=5 iff n == 4, 9, 15, 16, 20, 21, 39, 40, 44, 45, 51 or 56 (mod 60), etc. - M. F. Hasler, Dec 31 2012

Extensions

Corrected m = 100 by Kival Ngaokrajang, Dec 30 2012
Definition & example corrected by Kival Ngaokrajang, Dec 30 2012
More terms from N. J. A. Sloane, Dec 30 2012

A220890 a(n) = smallest m such that A187824(m) = n, or -1 if A187824 never takes the value n.

Original entry on oeis.org

-1, -1, -1, 2, 3, 4, 5, 29, 41, 55, 71, 881, 791, 9360, 10009, 1079, 30239, -1, 246960, -1, 636481, 1360800, 3160079, -1, 2162161
Offset: 0

Views

Author

N. J. A. Sloane, Dec 30 2012

Keywords

Comments

a(17) = -1. Proof: If x mod 9 and x mod 12 are both in {-1, 0, 1} then so is x mod 18. So if x is a number which is congruent to -1, 0 or 1 mod k for k=1..17, then also x mod 18 is congruent to -1, 0 or 1. So there is no x such that A187824(x) = 17. QED
From M. F. Hasler, Dec 30 2012 and Dec 31 2012: (Start)
Similarly, a(19) = -1. Indeed, if x == 0, 1 or -1 (mod 15) and (mod 12), then also (mod 60). [Proof: Write x = 15*(4k+d)+e, |e| < 2, then d = 1, 2, 3 all give impossible x (mod 12).] Therefore A187824 cannot have the value 19 (nor 29, nor 59).
Also, a(23) = -1, because x == 0, 1 or -1 (mod 8) and (mod 12) implies the same (mod 24). [To see this, write x = 12*(2k+d)+e, |e| < 2, then d = 1 gives impossible x (mod 8).] Therefore A187824 cannot have the value 23.
From A220891 one may deduce the values for n = 26, 28, 31, 36, 40, 42, 46, 48, 52, 58, 60, 61 to be a(n) = 39412801, 107881201, 3625549201, 170918748000, 2355997644001, 237662810985599, 4614209634434399, 7522575180120001, 362645725505263201, 10684484093105222399, 442709913651892286399, 5205240636387758366399. (End)
Don Reble shows that a(n) > -1 iff n + 1 is either 12, 2p, 3p or p^k > 3, where p is a prime, k >= 1. - M. F. Hasler, Mar 17 2020

Crossrefs

Programs

  • Maple
      N:= 70: # maximum m
    V[0]:= -1: V[1]:= -1: V[2]:= -1:
    S[3]:= {$0..5}: M[3]:= 6:
    # M[m] is the lcm of 1..m
    # S[m] is the set of residues mod M[m] for numbers n with A187824(n)>=m
    # A[m] is the set of residues mod M[m] for numbers n with A187824(n)=m-1
    for m from 4 to N+1 do
       M[m]:= ilcm(M[m-1], m); p:= M[m]/M[m-1];
       if p = 1 then T:= S[m-1]
       else T:= {seq(seq(a+b*M[m-1], a=S[m-1]), b=0..p-1)}
       end if;
       S[m],A[m]:= selectremove(t -> member(mods(t, m), {1, 0, -1}), T);
       if A[m] = {} then V[m-1]:= -1
       else V[m-1]:= min(A[m])
       end if;
    end do:
    seq(V[j], j=0..N);
    # Robert Israel, Dec 31 2012

Extensions

a(26) = 39412801. Double-checked all lower given values. - M. F. Hasler, Dec 30 2012

A220891 Where record values occur in A187824.

Original entry on oeis.org

2, 3, 4, 5, 29, 41, 55, 71, 791, 1079, 30239, 246960, 636481, 1360800, 2162161, 39412801, 107881201, 3625549201, 170918748000, 2355997644001, 237662810985599, 4614209634434399, 7522575180120001, 362645725505263201, 10684484093105222399, 442709913651892286399, 5205240636387758366399
Offset: 1

Views

Author

N. J. A. Sloane, Dec 30 2012

Keywords

Comments

Since A187824 is unbounded, this sequence is infinite.

Crossrefs

Programs

  • Maple
    N:= 20: # number of record values wanted
    R[1]:= 2: R[2]:= 3: r:= 3: count:= 2:
    S[3]:= {$0..5}: M[3]:= 6:
    # M[m] is the lcm of 1..m
    # S[m] is the set of residues mod M[m] for numbers n with A187824(n)>=m
    # R[i] is the i'th record value
    for m from 4 while count < N do
      M[m]:= ilcm(M[m-1],m); p:= M[m]/M[m-1];
      if p = 1 then T:= S[m-1]
      else T:= {seq(seq(a+b*M[m-1],a=S[m-1]),b=0..p-1)}
      end if;
      S[m]:= select(t -> member(mods(t,m),{1,0,-1}),T);
      r:= min(S[m] minus {0,1});
      if r > R[count] then
        count:= count+1; R[count]:= r
      end if;
    end do:
    [seq(R[j],j=1..count)];
    # Robert Israel, Dec 31 2012
  • PARI
    {m=0;for(n=1,9e9,m<A187824(n) || next; print1(n","); m=A187824(n))} \\ For illustrative purpose (values < 10^8) only. - M. F. Hasler, Dec 31 2012

A361247 a(n) is the smallest integer k > 2 that satisfies k mod j <= 2 for all integers j in 1..n.

Original entry on oeis.org

3, 3, 3, 4, 5, 6, 30, 42, 56, 72, 792, 792, 1080, 1080, 1080, 30240, 246961, 246961, 636482, 636482, 1360801, 2162162, 2162162, 2162162, 39412802, 39412802, 107881202, 107881202, 3625549202, 3625549202, 3625549202, 170918748001, 170918748001, 170918748001, 170918748001, 170918748001
Offset: 1

Views

Author

Andrew Cogliano, Mar 05 2023

Keywords

Examples

			a(7)=30 since 30 mod 7 = 2, 30 mod 6 = 0, 30 mod 5 = 0, 30 mod 4 = 2, 30 mod 3 = 0, 30 mod 2 = 0 and 30 is the smallest integer greater than 2 where all of these remainders are 2 or less.
		

Crossrefs

Cf. A003418 (all remainders 0).
Cf. also A361246, A361248.
Equals {A056697}+1. - Hugo Pfoertner, May 11 2023

Programs

  • PARI
    isok(k, n) = for (j=1, n, if ((k % j) > 2, return(0))); return(1);
    a(n) = my(k=3); while(!isok(k, n), k++); k; \\ Michel Marcus, Mar 17 2023
  • Python
    final=100
    k=3
    for n in range(1, final+1):
        j = n+1
        while (j > 2):
            j -= 1
            if k%j>2:
                  k += j-(k%j)
                  j = n+1
        print(k)
    

Extensions

a(32)-a(36) from Chai Wah Wu, Apr 24 2023
Showing 1-4 of 4 results.