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.

A378479 Numbers k such that in base 2 the k-th composite is a substring of the k-th prime.

This page as a plain text file.
%I A378479 #13 Dec 03 2024 12:23:40
%S A378479 16,17,98,210,654,3386,3387,3388,3389,3392,3395,3397,3398,3401,3504,
%T A378479 4806,22401,27997,30930,75126,109303,119466,119467,221344,265167,
%U A378479 391691,412566,772432,949072,1451888,2456497,2739020,2963199,4942623,4942624,4942631,4942632,4942634,4942636,4942637,4942638
%N A378479 Numbers k such that in base 2 the k-th composite is a substring of the k-th prime.
%C A378479 Numbers k such that A175349(k) = prime(k).
%e A378479 a(3) = 98 is a term because the 98th composite is 130 which is 10000010 in binary, the 98th prime is 521 which is 1000001001 in binary, and the first 8 bits of 1000001001 are 10000010.
%p A378479 g:= proc(p,c)
%p A378479    StringTools:-Search(convert(convert(c,binary),string),
%p A378479                          convert(convert(p,binary),string)) <> 0
%p A378479 end proc:
%p A378479 nextcomp:= proc(c)
%p A378479   if isprime(c+1) then c+2 else c+1 fi
%p A378479 end proc:
%p A378479 p:= 1: c:= 2: Res:= NULL: count:= 0:
%p A378479 for n from 1 to 10^7 do
%p A378479   p:= nextprime(p);
%p A378479   c:= nextcomp(c);
%p A378479   if g(p,c) then Res:= Res, n; count:= count+1; fi
%p A378479 od:
%p A378479 R;
%t A378479 p = 1;
%t A378479 c = 2;
%t A378479 Table[
%t A378479  p = NextPrime[p];
%t A378479  c += If[PrimeQ[c + 1], 2, 1];
%t A378479  mod = 2^BitLength[c];
%t A378479  test = NestWhile[BitShiftRight, p,
%t A378479    BitAnd[#, mod - 1] != c && # > c &];
%t A378479  If[test >= c, n, Nothing]
%t A378479  , {n, 10^5}]
%t A378479 (* _David Trimas_, Dec 01 2024 *)
%Y A378479 Cf. A000040, A002808, A175349.
%K A378479 nonn,base
%O A378479 1,1
%A A378479 _Robert Israel_, Nov 28 2024