OFFSET
1,3
COMMENTS
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.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Charles Marsden, Python program
EXAMPLE
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.
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.
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.
MATHEMATICA
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 *)
PROG
(Python) # See links.
(Python)
from sympy import nextprime, primepi
def A377483(n):
p, k, a = nextprime(n-1), primepi(n-1)+1, bin(n)[2:]
while True:
if a in bin(p)[2:]:
return k
p = nextprime(p)
k += 1 # Chai Wah Wu, Nov 20 2024
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Charles Marsden, Oct 29 2024
STATUS
approved