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.

A016726 Smallest k such that 1, 4, 9, ..., n^2 are distinct mod k.

Original entry on oeis.org

1, 2, 6, 9, 10, 13, 14, 17, 19, 22, 22, 26, 26, 29, 31, 34, 34, 37, 38, 41, 43, 46, 46, 53, 53, 53, 58, 58, 58, 61, 62, 67, 67, 71, 71, 73, 74, 79, 79, 82, 82, 86, 86, 89, 94, 94, 94, 97, 101, 101, 103, 106, 106, 109, 113, 113, 118, 118, 118, 122, 122, 127, 127, 131, 131, 134
Offset: 1

Views

Author

bernie(AT)wagnerpa.com (Bernie McCabe)

Keywords

Comments

This is the sequence of discriminators of the squares A000290, in the terminology of Arnold et al. - M. F. Hasler, May 04 2016

Crossrefs

Cf. A001751, A192419 (cubes), A192420 (4th powers), A347693.

Programs

  • Haskell
    a016726 n = a016726_list !! (n-1)
    a016726_list = [1,2,6,9] ++ (f 5 $ drop 4 a001751_list) where
       f n qs'@(q:qs) | q < 2*n   = f n qs
                      | otherwise = q : f (n+1) qs'
    -- Reinhard Zumkeller, Jun 20 2011
    
  • Mathematica
    a[n_] := (k = 2n; While[ Not[PrimeQ[k] || PrimeQ[k/2]], k++]; k); a[1]=1; a[2]=2; a[3]=6; a[4]=9; Table[a[n], {n, 1, 66}] (* Jean-François Alcover, Nov 30 2011, after formula *)
    sk[n_]:=Module[{k=2n,n2=Range[n]^2},While[Max[Tally[Mod[n2,k]][[All,2]]]> 1,k++];k]; Join[{1,2},Array[sk,70,3]] (* Harvey P. Dale, Oct 16 2016 *)
  • PARI
    A016726_vec(nMax)={my(S=[], a=1); vector(nMax, n, S=concat(S, n^2); while(#Set(S%a)M. F. Hasler, May 04 2016
    
  • PARI
    A016726(n)=if(n>4,min(nextprime(2*n),2*nextprime(n)),[1,2,6,9][n]) \\ M. F. Hasler, May 04 2016

Formula

For n > 4, a(n) is smallest k >= 2n such that k = p or k = 2p, p a prime.