%I #10 Nov 05 2024 10:30:54
%S 2,5,12,23,36,53,72,101,132,169,210,253,300,359,420,487,558,631,710,
%T 793,882,979,1082,1189,1298,1411,1538,1669,1806,1945,2094,2245,2402,
%U 2565,2732,2905,3084,3265,3456,3649,3846,4045,4256,4479,4706,4935,5168,5407
%N Sequence and first differences include all prime numbers exactly once.
%C Sequence and first differences:
%C 2 5 12 23 36 53 72 101 132 169 210 253 300 359 420...
%C .3.7.11.13.17.19.29...31..37..41..43..47..59..61...
%e All prime numbers appear once and only once, either in the sequence itself or in the first differences.
%p A109653diff :=proc(n)
%p option remember ;
%p if n = 2 then
%p 3;
%p else
%p for pidx from 1 do
%p fnd := false;
%p p := ithprime(pidx) ;
%p for i from 2 to n-1 do
%p if procname(i) = p then
%p fnd := true;
%p end if;
%p end do:
%p for i from 2 to n do
%p if A109653(i) = p then
%p fnd := true;
%p end if;
%p end do:
%p if not fnd then
%p return p;
%p end if;
%p end do:
%p end if;
%p end proc:
%p A109653 :=proc(n)
%p if n = 2 then
%p 2 ;
%p else
%p procname(n-1)+A109653diff(n-1) ;
%p end if;
%p end proc:
%p seq(A109653(n),n=2..80) ; # _R. J. Mathar_, Nov 05 2024
%t NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; a = {1}; d = 3; k = 2; Do[ While[ Position[a, d] != {}, d += 2 ]; k = k + d; d = NextPrim[d]; a = Append[a, k], {n, 47} ]; a (* _Robert G. Wilson v_ *)
%Y Cf. A247657
%K base,easy,nonn
%O 2,1
%A _Eric Angelini_, Aug 30 2005
%E More terms from _Robert G. Wilson v_, Sep 28 2005