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.

A377421 Numbers whose binary reversal is prime and unequal to the original number.

This page as a plain text file.
%I A377421 #36 Nov 18 2024 22:31:03
%S A377421 6,10,11,12,13,14,20,22,23,24,25,26,28,29,34,37,40,41,43,44,46,47,48,
%T A377421 50,52,53,55,56,58,61,62,67,68,71,74,77,80,82,83,86,88,91,92,94,96,97,
%U A377421 100,101,104,106,110,112,113,115,116,121,122,124,131,134,136,142
%N A377421 Numbers whose binary reversal is prime and unequal to the original number.
%C A377421 Contains A080790 and p*2^i for all primes p in A074832 union A080790 and i > 0. - _Michael S. Branicky_, Oct 29 2024
%H A377421 James C. McMahon, <a href="/A377421/b377421.txt">Table of n, a(n) for n = 1..10000</a>
%F A377421 a = A204232 - A006995 (as sets). - _Michael S. Branicky_, Oct 29 2024
%e A377421 6 = 110_2 is a term since reversed it is 011_2 = 3 which is prime.
%e A377421 7 = 111_2 is not a term since base 2 palindromic numbers are not included.
%t A377421 Select[Range[142],PrimeQ[r=FromDigits[Reverse[IntegerDigits[#,2]],2]]&&r!=#&] (* _James C. McMahon_, Nov 18 2024 *)
%o A377421 (Python)
%o A377421 from sympy import isprime
%o A377421 def ok(n): return (b:=bin(n)[2:]) != (br:=b[::-1]) and isprime(int(br, 2))
%o A377421 print([k for k in range(1, 143) if ok(k)]) # _Michael S. Branicky_, Oct 28 2024
%o A377421 (Python) # alternate program constructing terms directly from primes
%o A377421 from sympy import primerange
%o A377421 def auptobits(maxbits):
%o A377421     alst = []
%o A377421     for p in primerange(3, 1<<maxbits):
%o A377421         b = bin(p)[2:]; br = b[::-1]; t = int(br, 2)
%o A377421         if br != b: alst.append(t)
%o A377421         alst.extend(t<<i for i in range(1, maxbits-len(br)+1))
%o A377421     return sorted(alst)
%o A377421 print(auptobits(8)) # _Michael S. Branicky_, Oct 29 2024
%Y A377421 Supersequence of A080790.
%Y A377421 Cf. A030101, A006995, A074832, A204232.
%K A377421 nonn,base
%O A377421 1,1
%A A377421 _Simon R Blow_, Oct 27 2024