This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A175856 #43 Dec 10 2023 18:03:03 %S A175856 1,2,3,2,5,4,7,6,5,4,11,10,13,12,11,10,17,16,19,18,17,16,23,22,21,20, %T A175856 19,18,29,28,31,30,29,28,27,26,37,36,35,34,41,40,43,42,41,40,47,46,45, %U A175856 44,43,42,53,52,51,50,49,48,59,58,61,60,59,58,57,56,67,66 %N A175856 a(n) = a(n-1) - 1 if n is composite, a(n) = n otherwise. %C A175856 a(n) = n for noncomposite n, a(n) = 2 * (previous prime (n)) - n for composite n. %C A175856 See A175859 - absent positive integers (pairs of consecutive numbers) in sequence: 8, 9, 14, 15, 24, 25, 32, 33, ... %C A175856 a(n) = A075365(n) except at n = 1 and n = 10. - _Alexandre Herrera_, Nov 11 2023 %H A175856 Alois P. Heinz, <a href="/A175856/b175856.txt">Table of n, a(n) for n = 1..10000</a> %e A175856 a(7) = 7 (7 is a noncomposite number), a(8) = 2*7 - 8 = 6 (8 is composite). %p A175856 a:= proc(n) option remember; %p A175856 `if`(n=1 or isprime(n), n, a(n-1)-1) %p A175856 end: %p A175856 seq(a(n), n=1..80); # _Alois P. Heinz_, Jun 22 2021 %t A175856 a[1] := 1; a[n_] := a[n] = If[PrimeQ[n], n, a[n - 1] - 1] (* _Ben Branman_, Jan 02 2011 *) %t A175856 nxt[{n_,a_}]:={n+1,If[CompositeQ[n+1],a-1,n+1]}; NestList[nxt,{1,1},70][[All,2]] (* _Harvey P. Dale_, Jan 01 2023 *) %o A175856 (PARI) a(n)=if(n==1, 1, 2*precprime(n)-n) \\ _Charles R Greathouse IV_, Apr 22 2022~ %Y A175856 Cf. A002808, A008578, A175857, A175858, A175859, A175860, A175861, A175862, A075365. %K A175856 nonn,easy %O A175856 1,2 %A A175856 _Jaroslav Krizek_, Sep 29 2010 %E A175856 Corrected by _Jaroslav Krizek_, Oct 01 2010