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 A377483 #26 Nov 20 2024 20:45:09 %S A377483 1,1,2,7,3,6,4,7,8,13,5,24,6,10,11,19,7,12,8,13,14,24,9,25,24,16,17, %T A377483 30,10,18,11,32,19,33,20,21,12,63,22,38,13,68,14,24,29,70,15,25,30,26, %U A377483 27,47,16,29,48,30,50,51,17,53,18,54,31,55,32,77,19,33,34,60,20,79 %N A377483 Smallest index k such that prime(k) in base-2 contains n in base-2 as a contiguous substring. %C A377483 The intersections between this sequence and similar sequences in base-B occur at values of n that are the sequence of prime numbers, and values of a(n) that are the sequence of positive integers. %H A377483 Rémy Sigrist, <a href="/A377483/b377483.txt">Table of n, a(n) for n = 1..10000</a> %H A377483 Charles Marsden, <a href="/A377483/a377483.py.txt">Python program</a> %e A377483 For n=1 -> 1 in base-2. The first prime containing 1 in its base-2 form is prime(1)=2 -> 10. Therefore, a(1)=1. %e A377483 For n=3 -> 11 in base-2. The first prime containing 11 in its base-2 form is prime(2)=3 -> 11. Therefore, a(3)=2. %e A377483 For n=5 -> 101 in base-2. The first prime containing 101 in its base-2 form is prime(3)=5 -> 101. Therefore, a(5)=3. %t A377483 s={}; Do[k=0;Until[SequenceCount[IntegerDigits[Prime[k],2],IntegerDigits[n,2]]>0,k++]; AppendTo[s,k],{n,72}];s (* _James C. McMahon_, Nov 20 2024 *) %o A377483 (Python) # See links. %o A377483 (Python) %o A377483 from sympy import nextprime, primepi %o A377483 def A377483(n): %o A377483 p, k, a = nextprime(n-1), primepi(n-1)+1, bin(n)[2:] %o A377483 while True: %o A377483 if a in bin(p)[2:]: %o A377483 return k %o A377483 p = nextprime(p) %o A377483 k += 1 # _Chai Wah Wu_, Nov 20 2024 %o A377483 (PARI) a(n) = { my (w = 2^#binary(n), k = 0, r); forprime (p = 2, oo, k++; r = p; while (r >= n, if (r % w == n, return (k), r \= 2;););); } \\ _Rémy Sigrist_, Nov 20 2024 %Y A377483 Cf. A000040, A004676, A062584, A082058. %K A377483 nonn,base %O A377483 1,3 %A A377483 _Charles Marsden_, Oct 29 2024