OFFSET
0,2
REFERENCES
D. E. Knuth, The Art of Computer Programming, Vol. 3, Sorting and Searching, 2nd ed, section 5.2.1, p. 91.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Janet Incerpi and Robert Sedgewick, Improved upper bounds on shellsort, Journal of Computer and System Sciences, Volume 31, Issue 2, October 1985, Pages 210-224
Robert Sedgewick, Analysis of shellsort and related algorithms, Fourth European Symposium on Algorithms, Barcelona, September, 1996.
FORMULA
a(n) is the smallest number >= 2.5^n that is relatively prime to all previous terms in the sequence.
EXAMPLE
2.5^4 = 39.0625, and 41 is the next integer that is relatively prime to 1, 3, 7 and 16.
MAPLE
a:= proc(n) option remember; local l, m;
l:= [seq(a(i), i=1..n-1)];
for m from ceil((5/2)^n) while ormap(x-> igcd(m, x)>1, l) do od; m
end:
seq(a(n), n=0..30); # Alois P. Heinz, Jan 06 2022
MATHEMATICA
A036567[1] = 3;
A036567[q_] :=
With[{prev = A036567 /@ Range[q - 1]},
Block[{n = Ceiling[(5/2)^q]},
While[Nand @@ ((# == 1 &) /@ GCD[prev, n]), n++];
n]]; (* Morgan Owens, Oct 08 2020 *)
Array[A036567, 10]
PROG
(PARI) a036567(m)={my(v=vector(m)); for(n=1, m, my(b=ceil((5/2)^n)); for(j=b, oo, my(g=1); for(k=1, n-1, if(gcd(j, v[k])>1, g=0; break)); if(g, v[n]=j; break))); v};
a036567(28) \\ Hugo Pfoertner, Oct 15 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
Better description and more terms from Jud McCranie, Jan 05 2001
a(0)=1 prepended by Alois P. Heinz, Dec 04 2023
STATUS
approved