%I #33 Jan 26 2022 02:30:50
%S 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,
%T 16,32,48,51,289,578,102,36,26,73,219,30,20,14,46,50,470,60,40,146,21,
%U 49,28,113,29,19,35,42,54,64,22,77,329,84,56,292,365,65,37,131,38,33
%N a(n+1) is the smallest divisor of (2 + sum of first n terms) but not occurring earlier; a(1) = 1.
%C Conjecture: integer permutation with inverse A095259: a(A095259(n))=A095259(a(n))=n. - Comment revised: _Reinhard Zumkeller_, Dec 31 2014
%C A095260(n) = a(a(n)).
%C First fixed points: 1, 4, 54, 416, ...
%C A253415(n) = smallest missing number within the first n terms. - _Reinhard Zumkeller_, Dec 31 2014
%H Rémy Sigrist, <a href="/A095258/b095258.txt">Table of n, a(n) for n = 1..10000</a> (first 797 terms from Reinhard Zumkeller)
%H Michael De Vlieger, <a href="/A095258/a095258.png">Log-log scatterplot of a(n)</a> for n = 1..2^16.
%H Michael De Vlieger, <a href="/A095258/a095258_1.png">Annotated log-log scatterplot of a(n)</a> for n = 1..2^14 showing records in red, local minima in blue, primes in magenta, prime powers not prime in gold.
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t 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 *)
%o (Haskell)
%o import Data.List (delete)
%o a095258 n = a095258_list !! (n-1)
%o a095258_list = 1 : f [2..] 1 where
%o f xs z = g xs where
%o g (y:ys) = if mod z' y > 0 then g ys else y : f (delete y xs) (z + y)
%o z' = z + 2
%o -- _Reinhard Zumkeller_, Dec 31 2014
%o (Python)
%o from itertools import islice
%o from sympy import divisors
%o def A095258_gen(): # generator of terms
%o bset, s = {1}, 3
%o yield 1
%o while True:
%o for d in divisors(s):
%o if d not in bset:
%o yield d
%o bset.add(d)
%o s += d
%o break
%o A095258_list = list(islice(A095258_gen(),30)) # _Chai Wah Wu_, Jan 25 2022
%Y Cf. A253415.
%K nonn,look
%O 1,2
%A _Reinhard Zumkeller_, May 31 2004