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.

Showing 1-10 of 18 results. Next

A205533 Intersection of A205302 and A205511.

Original entry on oeis.org

19, 43, 101, 197, 457, 461, 643, 743, 859, 883, 937, 1301, 1483, 1579, 1877, 1949, 1997, 2083, 2129, 2141, 2221, 2237, 2251, 2381, 2539, 2609, 2617, 2659, 2663, 3019, 3221, 3389, 3461, 3701, 4003, 4157, 4517, 4637, 5573, 5741, 5783, 6763, 6899, 6907, 7349, 7757, 7877
Offset: 1

Views

Author

Keywords

Comments

Both Hamming's distances between a(n) and the previous prime and between a(n) and the next prime equal 1.

Crossrefs

Programs

  • Mathematica
    Select[Partition[Prime[Range[1000]], 3, 1], DigitCount[BitXor[#[[1]], #[[2]]], 2, 1] == DigitCount[BitXor[#[[2]], #[[3]]], 2, 1] == 1 &] [[;; , 2]] (* Amiram Eldar, Aug 06 2023 *)

Extensions

More terms from Amiram Eldar, Aug 06 2023

A205510 Binary Hamming distance between prime(n) and prime(n+1).

Original entry on oeis.org

1, 2, 1, 2, 2, 3, 1, 1, 2, 1, 4, 2, 1, 1, 3, 3, 2, 6, 1, 3, 2, 3, 2, 3, 1, 1, 2, 2, 3, 3, 6, 2, 1, 4, 1, 2, 5, 1, 2, 4, 2, 2, 6, 1, 1, 2, 2, 4, 2, 2, 2, 4, 2, 7, 2, 2, 1, 3, 2, 1, 5, 3, 1, 3, 1, 5, 3, 2, 2, 4, 2, 1, 3, 3, 1, 6, 1, 3, 1, 4, 2, 2, 4, 2, 2, 5, 1, 1, 1, 3, 2, 3, 2, 2, 1, 2, 7, 1, 3, 5
Offset: 1

Views

Author

Vladimir Shevelev, Jan 28 2012

Keywords

Comments

We call "Hamming's twin primes" the pairs of consecutive primes (p,q) with Hamming distance 1. They are (2,3), (5,7), (17,19,), (19,23), (29,31), (41,43), (43,47), (67,71), (97,101), ..., (A205511,A205302). As in Twin Primes Conjecture, we conjecture that there exist infinitely many Hamming's twin pairs.

Crossrefs

Programs

  • Maple
    a:= n-> add(i, i=Bits[GetBits](Bits[Xor](ithprime(n), ithprime(n+1)), 0..-1)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Oct 11 2017
  • Mathematica
    Table[Count[IntegerDigits[BitXor[Prime[n],Prime[n+1]],2],1],{n,100}] (* Jayanta Basu, May 26 2013 *)
  • PARI
    A205510(n)=norml2(binary(bitxor(prime(n),prime(n+1))))  \\ M. F. Hasler, Jan 29 2012
    
  • PARI
    a(n,p=prime(n),q=nextprime(p+1))=hammingweight(bitxor(p,q)) \\ Charles R Greathouse IV, Nov 15 2022

Extensions

Corrected a(24) and a(25) by M. F. Hasler, Jan 29 2012
Added "binary" to definition. - N. J. A. Sloane, Jul 09 2021

A206853 a(1)=1, for n>1, a(n) is the least number > a(n-1) such that the Hamming distance D(a(n-1), a(n)) = 2.

Original entry on oeis.org

1, 2, 4, 7, 11, 13, 14, 22, 26, 28, 31, 47, 55, 59, 61, 62, 94, 110, 118, 122, 124, 127, 191, 223, 239, 247, 251, 253, 254, 382, 446, 478, 494, 502, 506, 508, 511, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1534, 1790, 1918, 1982, 2014, 2030, 2038, 2042
Offset: 1

Views

Author

Vladimir Shevelev, Feb 13 2012

Keywords

Comments

For integers a, b, denote by a<+>b the least c>=a, such that D(a,c)=b (note that, generally speaking, a<+>b differs from b<+>a). Then a(n+1)=a(n)<+>2. Thus this sequence is a Hamming analog of odd numbers 1,3,5,...
A Hamming analog of nonnegative integers is A000225 and a Hamming analog of the triangular numbers is A000975.
All terms are odious (A000069).

Crossrefs

Cf. A182187 (n<+>2), A207063 (starting from 0).

Programs

  • Maple
    read("transforms");
    Hamming := proc(a,b)
            XORnos(a,b) ;
            wt(%) ;
    end proc:
    Dplus := proc(a,b)
            for c from a to 1000000 do
                    if Hamming(a,c)=b then
                            return c;
                    end if;
            end do:
            return -1 ;
    end proc:
    A206853 := proc(n)
            option remember;
            if n = 1 then
                    1;
            else
                    Dplus(procname(n-1),2) ;
            end if;
    end proc: # R. J. Mathar, Apr 05 2012
  • Mathematica
    myHammingDistance[n_, m_] := Module[{g = Max[m, n], h = Min[m, n]}, b1 = IntegerDigits[g, 2]; b2 = IntegerDigits[h, 2, Length[b1]]; HammingDistance[b1, b2]]; t = {1}; Do[If[myHammingDistance[t[[-1]], n] == 2, AppendTo[t, n]], {n, 2, 2042}]; t (* T. D. Noe, Mar 07 2012 *)
    t={x=1}; Do[i=x+1; While[Count[IntegerDigits[BitXor[x,i],2],1]!=2,i++]; AppendTo[t,x=i],{n,53}]; t (* Jayanta Basu, May 26 2013 *)
  • PARI
    next_A206853(n)={my(b=binary(n)); until(norml2(binary(n)-b)==2, n++>=2^#b & b=concat(0,b)); n}
    print1(n=1); for(i=1,99,print1(","n=next_A206853(n)))  \\ M. F. Hasler, Apr 07 2012

A205302 Greater of Hamming's twin primes.

Original entry on oeis.org

3, 7, 19, 23, 31, 43, 47, 71, 101, 103, 139, 151, 167, 197, 199, 271, 283, 311, 317, 367, 383, 397, 409, 457, 461, 463, 503, 523, 571, 619, 643, 647, 677, 743, 751, 773, 811, 823, 859, 863, 883, 887, 911, 937, 941, 991, 1013, 1051, 1063, 1117, 1231, 1279, 1291, 1301, 1303, 1483, 1487
Offset: 1

Views

Author

Vladimir Shevelev, Jan 28 2012

Keywords

Comments

The Hamming distance between a(n) and the previous prime is 1 (cf. A205510).

Crossrefs

Programs

  • Mathematica
    Select[Partition[Prime[Range[250]], 2, 1], DigitCount[BitXor[First[#], Last[#]], 2, 1] == 1 &] [[;; , 2]] (* Amiram Eldar, Aug 06 2023 *)
  • PARI
    n=0;for(i=1,80,until(A205510(n++)==1,);print1(prime(n+1)","))  \\ M. F. Hasler, Jan 29 2012

Extensions

a(10)-a(57) from Peter J. C. Moses, Jan 28 2012
Values verified by M. F. Hasler, Jan 29 2012

A205649 Hamming distance between twin primes.

Original entry on oeis.org

2, 1, 2, 1, 1, 1, 2, 3, 1, 2, 1, 1, 2, 6, 1, 2, 4, 1, 1, 3, 2, 2, 4, 1, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 7, 1, 1, 1, 1, 3, 2, 2, 1, 4, 3, 2, 2, 1, 1, 2, 4, 1, 2, 1, 1, 2, 1, 3, 6, 1, 1, 1, 2, 1, 2, 1, 1, 5, 1, 7, 3, 1, 1, 1, 1, 3, 4, 5, 2, 1, 2
Offset: 1

Views

Author

Vladimir Shevelev, Jan 30 2012

Keywords

Comments

Twin primes for which a(n)=1 are in A122565.
Conjecture: The sequence is unbounded.

Crossrefs

Programs

  • Mathematica
    nn = 1000; ps = Prime[Range[nn]]; t = {}; Do[If[ps[[n]] + 2 == ps[[n + 1]], AppendTo[t, ps[[n]]]], {n, nn - 1}]; Table[b2 = IntegerDigits[t[[k]] + 2, 2];  b1 = IntegerDigits[t[[k]], 2, Length[b2]]; Total[Abs[b1 - b2]], {k, Length[t]}] (* T. D. Noe, Jan 30 2012 *)

Formula

A001359(n) == -1 (mod 2^a(n)).

A206960 a(0)=0, a(1)=1, for n>1, a(n) = n<*>n, where k<*>m = k<+>k<+>...<+>k is the m-1-fold iteration of the operation <+> defined in A206853.

Original entry on oeis.org

0, 1, 4, 9, 31, 66, 190, 385, 1022, 2055, 5112, 10242, 24572, 49153, 114686, 229377, 524287, 1048590, 2359281, 4718599, 10485753, 20971521, 46137342, 92274689, 201326590, 402653191, 872415224, 1744830466, 3758096380, 7516192769, 16106127358, 32212254721
Offset: 0

Views

Author

Vladimir Shevelev and Konstantin Shukhmin (shukhmin(AT)callsouth.net.nz), Feb 14 2012

Keywords

Comments

A Hamming's analog of n^2.

Crossrefs

Programs

  • Mathematica
    f[n_,k_]:=Module[{i=n+1},While[Count[IntegerDigits[BitXor[n,i],2],1]!=k,i++]; i]; Join[{0,1},Table[Nest[f[#,k]&,k,k-1],{k,2,18}]] (* Jayanta Basu, May 26 2013 *)

Formula

A010060(a(n)) = A010060(n). - Vladimir Shevelev and Alois P. Heinz, Feb 17 2012

Extensions

a(11)-a(31) from Alois P. Heinz, Feb 16 2012

A182187 a(n) is the least m >= n such that the Hamming distance D(n,m) = 2.

Original entry on oeis.org

3, 2, 4, 5, 7, 6, 10, 11, 11, 10, 12, 13, 15, 14, 22, 23, 19, 18, 20, 21, 23, 22, 26, 27, 27, 26, 28, 29, 31, 30, 46, 47, 35, 34, 36, 37, 39, 38, 42, 43, 43, 42, 44, 45, 47, 46, 54, 55, 51, 50, 52, 53, 55, 54, 58, 59, 59, 58, 60, 61, 63, 62, 94, 95, 67, 66, 68
Offset: 0

Views

Author

Vladimir Shevelev, Apr 17 2012

Keywords

Comments

a(n) = n<+>2 (see comment in A206853).

Crossrefs

Cf. A206853 (trajectory of 1), A207063 (trajectory of 0).
Cf. A209544 (primes which are not terms), A209554 (and also not n<+>3).
Cf. A086799 ((n-1)<+>1), A182209 (n<+>3), A182336 (n<+>4).

Programs

  • Maple
    HD:= (i, j)-> add(h, h=Bits[Split](Bits[Xor](i, j))):
    a:= proc(n) local c;
          for c from n do if HD(n, c)=2 then return c fi od
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Apr 17 2012
  • Mathematica
    t={}; Do[i=n+1; While[Count[IntegerDigits[BitXor[n,i],2],1]!=2,i++]; AppendTo[t,i],{n,0,66}]; t (* Jayanta Basu, May 26 2013 *)
  • PARI
    a(n) = bitxor(n, 3<>1+1,2)); \\ Kevin Ryde, Jul 09 2021
  • Python
    def a(n):
      m = n + 1
      while bin(n^m).count('1') != 2: m += 1
      return m
    print([a(n) for n in range(67)]) # Michael S. Branicky, Mar 02 2021
    
  • Sage
    def A182187(n):
        S = n.bits(); T = S; c = n; L = len(S)
        while true:
             H = sum(a != b for a, b in zip(S, T))
             if H == 2: return c
             c += 1; T = c.bits()
             if len(T) > L: L += 1; S.append(0)
    [A182187(n) for n in (0..66)]   # Peter Luschny, May 26 2013
    

Formula

If n is odd, then a(n) = n+2^(A007814(n+1)-1); if n == 2 (mod 4), then a(n) = n+2^(A007814(n+2)-1); if n == 0 (mod 4), then a(n) = n+3.
Using this formula, we can prove the conjecture formulated in comment in A209554 in the case k=2. Moreover, let us show that if N does not have the form 8*t or 8*t+1, then it can be represented in the form n<+>2. Indeed, in the cases N = 8*t+2, 8*t+4, 8*t+6, 8*t+3, 8*t+5 and 8*t+7 it is sufficient to choose n=N-4, n=N-2, n=N-1, n=N-3, n=N-2 and n = N-3 respectively; in the cases 8*t, 8*t+1, for every choice of n <= N, we do not obtain the equality n<+>2 = N.
In addition, note that n<+>1 = n + 2^A007814(n+1) = A086799(n+1).

Extensions

More terms from Alois P. Heinz, Apr 17 2012

A207017 Numbers m for which there exists a number 1k, where operation <+> is defined in A206853.

Original entry on oeis.org

4, 7, 9, 11, 13, 14, 16, 18, 21, 22, 24, 26, 28, 31, 33, 35, 39, 41, 44, 46, 47, 49, 50, 53, 55, 56, 57, 59, 61, 62, 63, 66, 70, 73, 79, 82, 83, 84, 89, 93, 94, 96, 97, 102, 104, 110, 111, 112, 115, 116, 118, 120, 121, 122, 124, 125, 126, 127, 129, 131
Offset: 1

Views

Author

Vladimir Shevelev, Feb 14 2012

Keywords

Comments

It is natural to call terms of the sequence "Hamming composite numbers" and to say that m is "H-divisible" by k.

Examples

			127 = b_21 for k=2, b_16 for k=4 and b_8 for k=5. Thus 127 is H-divisible by 2, 4 and 5 (and only by them).
		

Crossrefs

A182209 a(n) is the least m >= n, such that the Hamming distance D(n,m) = 3.

Original entry on oeis.org

7, 6, 5, 4, 9, 8, 8, 9, 15, 14, 13, 12, 16, 17, 18, 19, 23, 22, 21, 20, 25, 24, 24, 25, 31, 30, 29, 28, 36, 37, 38, 39, 39, 38, 37, 36, 41, 40, 40, 41, 47, 46, 45, 44, 48, 49, 50, 51, 55, 54, 53, 52, 57, 56, 56, 57, 63, 62, 61, 60, 76, 77, 78, 79, 71, 70, 69
Offset: 0

Views

Author

Vladimir Shevelev, Apr 18 2012

Keywords

Comments

a(n) = n<+>3 (see comment in A206853).

Crossrefs

Cf. A086799 ((n-1)<+>1), A182187 (n<+>2), A182336 (n<+>4).
Cf. A209554 (primes which are not terms nor n<+>2 terms).

Programs

  • Maple
    HD:= (i, j)-> add(h, h=Bits[Split](Bits[Xor](i, j))):
    a:= proc(n) local c;
          for c from n do if HD(n, c)=3 then return c fi od
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Apr 18 2012
  • PARI
    a(n) = bitxor(n, if(bitand(n,14)==4, 13, 7<>2+1,2))); \\ Kevin Ryde, Jul 10 2021
  • Python
    def d(n, m): return bin(n^m).count('1')
    def a(n):
        m = n+1
        while d(n, m) != 3: m += 1
        return m
    print([a(n) for n in range(67)]) # Michael S. Branicky, Jul 06 2021
    

Formula

If n==i mod 8, then a(n) = n-2*i+7, i=0,1,2,3; if n==4 mod 16, then a(n) = n+5; if n==12 mod 16, then a(n) = n+2^(A007814(n+4)-2); if n==5 mod 16, then a(n) = n+3; if n==13 mod 16, then a(n) = n+2^(A007814(n+3)-2); if n==6 mod 8, then a(n) = n+2^(A007814(n+2)-2); if n==7 mod 8, then a(n) = n+2^(A007814(n+1)-2).
Using this formula, we can prove conjecture formulated in comment in A209554 in case k=3. Moreover, one can prove that N could be represented in form n<+>2 or n<+>3 iff N is not a number of the forms 32*t, 32*t+1. - Vladimir Shevelev, Apr 25 2012

A207016 a(1) = 3 , for n > 1 a(n) is the least number greater than a(n-1) such that the Hamming distance D(a(n-1),a(n)) = 3.

Original entry on oeis.org

3, 4, 9, 14, 18, 21, 24, 31, 39, 41, 46, 50, 53, 56, 63, 79, 83, 84, 89, 94, 102, 104, 111, 115, 116, 121, 126, 158, 166, 168, 175, 179, 180, 185, 190, 206, 210, 213, 216, 223, 231, 233, 238, 242, 245, 248, 255, 319, 335, 339, 340, 345, 350, 358, 360, 367, 371
Offset: 1

Views

Author

Vladimir Shevelev, Feb 14 2012

Keywords

Comments

Odious and evil terms are alternating (cf. A000069, A001969).

Crossrefs

Programs

  • Mathematica
    a[1] = 3; a[n_] := a[n] = Module[{k = a[n - 1], m = a[n-1] + 1}, While[DigitCount[BitXor[k, m], 2, 1] != 3, m++]; m]; Array[a, 100] (* Amiram Eldar, Aug 06 2023 *)
  • PARI
    list(n)=my(v=vector(n));v[1]=3;for(i=2,n,v[i]=v[i-1]; while(hammingweight(bitxor(v[i-1],v[i]++))!=3,));v \\ Charles R Greathouse IV, Mar 26 2013
Showing 1-10 of 18 results. Next