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.

A338884 The smallest number of bits which need to be appended to the binary representation of n to reach a prime greater than n.

This page as a plain text file.
%I A338884 #22 Nov 23 2020 01:47:23
%S A338884 1,1,1,2,1,1,2,1,1,2,1,3,2,1,1,2,2,1,2,1,1,2,1,2,2,1,2,2,1,1,2,2,1,2,
%T A338884 1,1,2,3,1,2,1,3,2,1,2,3,2,1,2,1,1,2,1,1,2,1,2,2,2,2,3,2,1,2,1,4,2,1,
%U A338884 1,2,3,3,2,1,1,2,2,1,2,3,1,2,1,2,3,1,2
%N A338884 The smallest number of bits which need to be appended to the binary representation of n to reach a prime greater than n.
%C A338884 a(n) is also the distance from a node to its first prime-number descendant in a binary tree defined as: root = 1 and, for any node n, the left child = 2*n and right child = 2*n + 1. The number of primes among the nodes of depth m is equal to A036378(m) for m>=2.
%F A338884 a(n) = bitlength(A208241(n)) - bitlength(n), where bitlength = A070939. - _Kevin Ryde_, Nov 13 2020
%o A338884 (Python)
%o A338884 from sympy import isprime
%o A338884 for n in range(1,101):
%o A338884     a = 0
%o A338884     k = i = 1
%o A338884     while isprime(i) == 0:
%o A338884         a += 1
%o A338884         k = 2*k
%o A338884         for i in range(k*n + 1, k*n + k):
%o A338884             if isprime(i) == 1: break
%o A338884     print(a)
%Y A338884 Cf. A000040, A036378, A208241, A005097 (where a(n)=1).
%Y A338884 Cf. A108234 (zero or more bits).
%K A338884 nonn
%O A338884 1,4
%A A338884 _Ya-Ping Lu_, Nov 13 2020