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.

A034796 a(1)=1, a(n-1) is a square mod a(n), and a(n) > a(n-1).

Original entry on oeis.org

1, 2, 7, 9, 10, 13, 17, 19, 25, 26, 34, 37, 41, 43, 49, 50, 62, 67, 73, 74, 82, 87, 89, 94, 97, 99, 105, 106, 109, 113, 121, 122, 127, 129, 130, 133, 137, 139, 145, 146, 157, 162, 167, 173, 178, 181, 185, 187, 193, 194, 206, 214, 217, 218, 223, 237, 241, 243, 249
Offset: 1

Views

Author

Keywords

Comments

a(n) is the smallest number larger than a(n-1) such that a(n-1) is a quadratic residue mod a(n). - R. J. Mathar, Jul 27 2015

Examples

			For n=3 we have a(2)=2. 2 is not quadratic residue mod 3 because the quadratic residues mod 3 are {0,1}, see A011655. 2 is not a quadratic residue mod 4 because the quadratic residues mod 4 are {0,1}, see A000035. 2 is not a quadratic residue mod 5 because the quadratic residues mod 5 are {0,1,4}, see A070430. 2 is not a quadratic residue mod 6 because the quadratic residues mod 6 are {0,1,3,4}, see A070431. 2 is a quadratic residue mod 7 because the quadratic residues mod 7 are {0,1,2,4}, see A053879. So a(3)=7. - _R. J. Mathar_, Jul 27 2015
		

Programs

  • Maple
    A034796 := proc(n)
        option remember;
        if n = 1 then
            1;
        else
            for a from procname(n-1)+1 do
                if numtheory[quadres](procname(n-1),a) = 1 then
                    return a;
                end if;
            end do:
        end  if;
    end proc: # R. J. Mathar, Jul 27 2015
  • Mathematica
    residueQ[n_, k_] := Length[ Select[ Range[ Floor[k/2]]^2, Mod[#, k] == n &, 1]] == 1; a[1] = 1; a[n_] := a[n] = For[k = a[n-1] + 1, True, k++, If[residueQ[a[n-1], k], Return[k]]]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Aug 13 2013 *)

Extensions

Clarified definition, Joerg Arndt, Aug 14 2013