cp's OEIS Frontend

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.

A005381 Numbers k such that k and k-1 are composite.

This page as a plain text file.
%I A005381 M4598 #47 Sep 18 2022 11:06:20
%S A005381 9,10,15,16,21,22,25,26,27,28,33,34,35,36,39,40,45,46,49,50,51,52,55,
%T A005381 56,57,58,63,64,65,66,69,70,75,76,77,78,81,82,85,86,87,88,91,92,93,94,
%U A005381 95,96,99,100,105,106,111,112,115,116,117,118,119,120,121,122
%N A005381 Numbers k such that k and k-1 are composite.
%C A005381 Position where the composites first outnumber the primes by n, among the first natural numbers. - _Lekraj Beedassy_, Jul 11 2006
%D A005381 M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 844.
%D A005381 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A005381 J. Stauduhar, <a href="/A005381/b005381.txt">Table of n, a(n) for n = 1..10000</a>
%H A005381 M. Abramowitz and I. A. Stegun, eds., <a href="http://www.convertit.com/Go/ConvertIt/Reference/AMS55.ASP">Handbook of Mathematical Functions</a>, National Bureau of Standards, Applied Math. Series 55, Tenth Printing, 1972 [alternative scanned copy].
%H A005381 R. P. Boas & N. J. A. Sloane, <a href="/A005381/a005381.pdf">Correspondence, 1974</a>
%H A005381 B. W. J. Irwin, <a href="https://www.authorea.com/users/5445/articles/111406/_show_article">Recursive Modular Conjecture for pi(n)</a>.
%F A005381 Conjecture: pi(n)=Sum_{k=1..n} k mod a(m) mod a(m-1) ... mod a(1) mod 2, for all values 1<n<=a(m), where the mod are evaluated from left to right. Verified for first 10000 a(n). - _Benedict W. J. Irwin_, May 04 2016
%F A005381 As a check, take n=9, m=2, a(m)=10. Then we must take the numbers 1 through 9 and reduce them mod 10 then mod 9 then mod 2. The results are 1,0,1,0,1,0,1,0,0, whose sum is 4 = pi(9), as predicted. - _N. J. A. Sloane_, May 05 2016
%F A005381 For an attempt at a proof for the conjecture above, see the link. If it is true, then for n>2, isprime(n)=(n mod x) mod 2, where x is the largest a(n)<=n. - _Benedict W. J. Irwin_, May 06 2016
%p A005381 isA005381 := proc(n)
%p A005381     not isprime(n) and not isprime(n-1) ;
%p A005381 end proc:
%p A005381 A005381 := proc(n)
%p A005381     local a;
%p A005381     option remember;
%p A005381     if n = 1 then
%p A005381         9;
%p A005381     else
%p A005381         for a from procname(n-1)+1 do
%p A005381             if isA005381(a) then
%p A005381                 return a;
%p A005381             end if;
%p A005381         end do:
%p A005381     end if;
%p A005381 end proc: # _R. J. Mathar_, Jul 14 2015
%p A005381 # second Maple program:
%p A005381 q:= n-> ormap(isprime, [n, n-1]):
%p A005381 remove(q, [$2..130])[];  # _Alois P. Heinz_, Dec 26 2021
%t A005381 Select[Range[2, 200], ! PrimeQ[# - 1] && ! PrimeQ[#] &]
%o A005381 (PARI) is(n)=!isprime(n)&&!isprime(n-1) \\ _M. F. Hasler_, Jan 07 2019
%o A005381 (Python)
%o A005381 from sympy import isprime
%o A005381 def ok(n): return n > 3 and not isprime(n) and not isprime(n-1)
%o A005381 print([k for k in range(122) if ok(k)]) # _Michael S. Branicky_, Dec 26 2021
%Y A005381 Equals A068780 + 1. Cf. A007921.
%Y A005381 Cf. A093515 (complement, apart from 1 which is in neither sequence), A323162 (characteristic function).
%K A005381 nonn,easy
%O A005381 1,1
%A A005381 _N. J. A. Sloane_