A095258 a(n+1) is the smallest divisor of (2 + sum of first n terms) but not occurring earlier; a(1) = 1.
1, 3, 2, 4, 6, 9, 27, 18, 8, 5, 17, 34, 68, 12, 24, 10, 25, 11, 13, 23, 7, 47, 94, 235, 15, 16, 32, 48, 51, 289, 578, 102, 36, 26, 73, 219, 30, 20, 14, 46, 50, 470, 60, 40, 146, 21, 49, 28, 113, 29, 19, 35, 42, 54, 64, 22, 77, 329, 84, 56, 292, 365, 65, 37, 131, 38, 33
Offset: 1
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000 (first 797 terms from Reinhard Zumkeller)
- Michael De Vlieger, Log-log scatterplot of a(n) for n = 1..2^16.
- Michael De Vlieger, Annotated log-log scatterplot of a(n) for n = 1..2^14 showing records in red, local minima in blue, primes in magenta, prime powers not prime in gold.
- Index entries for sequences that are permutations of the natural numbers
Crossrefs
Cf. A253415.
Programs
-
Haskell
import Data.List (delete) a095258 n = a095258_list !! (n-1) a095258_list = 1 : f [2..] 1 where f xs z = g xs where g (y:ys) = if mod z' y > 0 then g ys else y : f (delete y xs) (z + y) z' = z + 2 -- Reinhard Zumkeller, Dec 31 2014
-
Mathematica
c[] = 0; j = c[1] = 1; s = 3; {j}~Join~Reap[Do[d = Divisors[s]; k = 1; While[c[d[[k]]] > 0, k++]; Set[k, d[[k]]]; Set[c[k], i]; Sow[k]; j = k; s += k, {i, 2, 80}]][[-1, -1]] (* _Michael De Vlieger, Jan 23 2022 *)
-
Python
from itertools import islice from sympy import divisors def A095258_gen(): # generator of terms bset, s = {1}, 3 yield 1 while True: for d in divisors(s): if d not in bset: yield d bset.add(d) s += d break A095258_list = list(islice(A095258_gen(),30)) # Chai Wah Wu, Jan 25 2022
Comments