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.

A377270 Smallest index k such that the k-th prime number in base-2 contains the n-th Fibonacci number in base-2 as a contiguous substring.

This page as a plain text file.
%I A377270 #52 Nov 29 2024 21:38:40
%S A377270 1,1,1,2,3,7,6,14,33,48,24,106,51,240,362,305,251,1269,1047,1752,2456,
%T A377270 3773,3121,8959,39089,62223,33299,177305,42613,238782,373418,699763,
%U A377270 916051,2715933,2256419,13103923,7100513,16902825,13833549,11323041,66402079,54299882
%N A377270 Smallest index k such that the k-th prime number in base-2 contains the n-th Fibonacci number in base-2 as a contiguous substring.
%C A377270 The intersections between this sequence and similar sequences in base-B occur at values of n that are the indices of prime Fibonacci numbers, and values of a(n) such that the a(n)-th prime number is a Fibonacci number.
%H A377270 Daniel Suteu, <a href="/A377270/b377270.txt">Table of n, a(n) for n = 1..88</a>
%H A377270 Charles Marsden, <a href="/A377270/a377270_4.py.txt">Python program</a>
%F A377270 a(n) = A377483(A000045(n)). - _Pontus von Brömssen_, Nov 29 2024
%e A377270 For n=1, fib(1)=1 -> 1 in base-2. The first prime containing 1 in its base-2 form is P(1)=2 -> 10. Therefore, a(1)=1.
%e A377270 For n=4, fib(4)=3 -> 11 in base-2. The first prime containing 11 in its base-2 form is P(2)=3 -> 11. Therefore, a(4)=2.
%e A377270 For n=6, fib(6)=8 -> 1000 in base-2. The first prime containing 1000 in its base-2 form is P(7)=17 -> 10001. Therefore, a(6)=7.
%t A377270 s={}; Do[k=0; Until[SequenceCount[IntegerDigits[Prime[k], 2], IntegerDigits[Fibonacci[n], 2]]>0, k++]; AppendTo[s, k], {n, 31}]; s (* _James C. McMahon_, Nov 21 2024 *)
%o A377270 (Python) # See links.
%o A377270 (Python)
%o A377270 from sympy import fibonacci, nextprime, primepi
%o A377270 def A377270(n):
%o A377270     f = fibonacci(n)
%o A377270     p, k, a = nextprime(f-1), primepi(f-1)+1, bin(f)[2:]
%o A377270     while True:
%o A377270         if a in bin(p)[2:]:
%o A377270             return k
%o A377270         p = nextprime(p)
%o A377270         k += 1 # _Chai Wah Wu_, Nov 20 2024
%o A377270 (Sidef)
%o A377270 for n in (1..35) {
%o A377270     var bin = n.fib.as_bin
%o A377270     var min = Inf
%o A377270     for k in (0..Inf) {
%o A377270         ['0','1'].variations_with_repetition(k, {|*a|
%o A377270             [a..., bin].variations(a.len+1, {|*t|
%o A377270                 var m = Num(t.join, 2)
%o A377270                 if (m.is_prime && m.as_bin.contains(bin)) {
%o A377270                     min = m if (m < min)
%o A377270                 }
%o A377270             })
%o A377270         })
%o A377270         break if (min < Inf)
%o A377270     }
%o A377270     print(min.primepi, ", ")
%o A377270 } # _Daniel Suteu_, Nov 02 2024
%Y A377270 Cf. A000040, A000045, A001605, A004676, A099000, A377483.
%K A377270 nonn,base
%O A377270 1,4
%A A377270 _Charles Marsden_, Oct 22 2024
%E A377270 a(36)-a(42) from _Daniel Suteu_, Nov 02 2024