OFFSET
1,2
COMMENTS
For 7 <= n < 10^12.5, a(n) = (n-3)^2. On the ERH this holds for all n >= 7; unconditionally it holds for all but finitely many n. - Charles R Greathouse IV, Mar 29 2012
a(n) is the smallest integer larger than a(n-1) such that a(n) is a quadratic residuum modulo all a(i), 1<=i<n. - R. J. Mathar, Jul 27 2015
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..500
FORMULA
Apparently includes all positive squares along with 2, 3 and 13.
MAPLE
A034793 := proc(n)
option remember;
local a, wrks ;
if n = 1 then
1;
else
for a from procname(n-1)+1 do
wrks := true;
for i from 1 to n-1 do
if numtheory[quadres](a, procname(i)) <> 1 then
wrks := false;
break;
end if;
end do;
if wrks then
return a;
end if;
end do:
end i # R. J. Mathar, Jul 27 2015
MATHEMATICA
a[n_ ] := If[n<7, {1, 2, 3, 4, 9, 13}[[n]], (n-3)^2]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Jul 22 2015, after Charles R Greathouse IV *)
PROG
(Haskell)
a034793 n = a034793_list !! (n-1)
a034793_list = 1 : f [2..] [1] where
f (x:xs) ys | and $ map (isSquMod x) ys = x : f xs (x:ys)
| otherwise = f xs ys
isSquMod u v = u `mod` v `elem` (map ((`mod` v) . (^ 2)) [0..v-1])
-- Reinhard Zumkeller, Mar 27 2012
(PARI) a(n)=if(n<7, [1, 2, 3, 4, 9, 13][n], (n-3)^2) \\ Charles R Greathouse IV, Mar 29 2012
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
EXTENSIONS
More precise definition from Giovanni Resta, Jul 22 2015
STATUS
approved