A109653 Sequence and first differences include all prime numbers exactly once.
2, 5, 12, 23, 36, 53, 72, 101, 132, 169, 210, 253, 300, 359, 420, 487, 558, 631, 710, 793, 882, 979, 1082, 1189, 1298, 1411, 1538, 1669, 1806, 1945, 2094, 2245, 2402, 2565, 2732, 2905, 3084, 3265, 3456, 3649, 3846, 4045, 4256, 4479, 4706, 4935, 5168, 5407
Offset: 2
Examples
All prime numbers appear once and only once, either in the sequence itself or in the first differences.
Crossrefs
Cf. A247657
Programs
-
Maple
A109653diff :=proc(n) option remember ; if n = 2 then 3; else for pidx from 1 do fnd := false; p := ithprime(pidx) ; for i from 2 to n-1 do if procname(i) = p then fnd := true; end if; end do: for i from 2 to n do if A109653(i) = p then fnd := true; end if; end do: if not fnd then return p; end if; end do: end if; end proc: A109653 :=proc(n) if n = 2 then 2 ; else procname(n-1)+A109653diff(n-1) ; end if; end proc: seq(A109653(n),n=2..80) ; # R. J. Mathar, Nov 05 2024
-
Mathematica
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 *)
Extensions
More terms from Robert G. Wilson v, Sep 28 2005
Comments