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.

A144477 a(n) = minimal number of 0's that must be changed to 1's in the binary expansion of the n-th prime in order to make it into a palindrome.

This page as a plain text file.
%I A144477 #25 Jul 09 2025 04:29:58
%S A144477 1,0,0,0,1,1,0,1,1,1,0,1,1,2,1,2,1,1,1,2,0,2,2,1,1,2,1,0,2,2,0,1,1,2,
%T A144477 2,3,1,2,1,1,3,1,1,1,2,1,1,1,1,1,3,1,3,1,0,2,2,3,1,1,2,2,2,3,0,1,3,1,
%U A144477 3,1,2,2,1,1,2,1,2,3,1,2,1,3,1,2,2,0,2,3,2,1,1,1,1,1,2,1,1,1,2,3
%N A144477 a(n) = minimal number of 0's that must be changed to 1's in the binary expansion of the n-th prime in order to make it into a palindrome.
%H A144477 Paolo Xausa, <a href="/A144477/b144477.txt">Table of n, a(n) for n = 1..10000</a>
%F A144477 a(n) is half the Hamming distance between the binary expansion of prime(n) and its reversal.
%e A144477 a(5) = 1 since prime(5) = 11 = 1011_2 becomes a palindrome if we change the third bit to 0.
%t A144477 A144477[n_]:=With[{p=IntegerDigits[Prime[n],2]},HammingDistance[p,Reverse[p]]/2];Array[A144477,100] (* _Paolo Xausa_, Nov 13 2023 *)
%o A144477 (PARI)
%o A144477 HD(p)=
%o A144477 {
%o A144477   v=binary(p); H=0; j=#v;
%o A144477   for(k=1,#v, H+=abs(v[k]-v[j]); j--);
%o A144477   return(H)
%o A144477 };
%o A144477 for(n=1,100, p=prime(n); an=HD(p)/2; print1(an,", "))
%Y A144477 Subsequence of A037888.
%K A144477 nonn,base
%O A144477 1,14
%A A144477 _Washington Bomfim_, Jan 15 2011, following a suggestion from _Joerg Arndt_
%E A144477 Edited by _N. J. A. Sloane_, Apr 23 2020 at the suggestion of _Harvey P. Dale_