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-2 of 2 results.

A278966 Least Hamming weight of multiples of the n-th prime.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Since all primes after the first are odd, a(n) > 1 for n > 1.
a(n) = 2 if and only if A014664(n) is even, or equivalently prime(n) is not in A014663. - Robert Israel, Dec 08 2016
If prime(n) = A000668(k), then a(n) = A000043(k). - Robert Israel, Dec 20 2016

Crossrefs

Programs

  • Maple
    f:= proc(n) local p, R, V, W, k,v,r;
        p:= ithprime(n);
        R:= {seq(2 &^ i mod p, i=0..numtheory:-order(2,p)-1)};
        Rm:= map(t -> p-t, R);
        V:= R;
        W:= V;
        for k from 2 do
          if nops(V intersect Rm) > 0 then return k fi;
          V:= {seq(seq(v+r mod p, v=V),r=R)} minus W;
        W:= W union V;
        od
    end proc:
    f(1):= 1:
    map(f, [$1..100]); # Robert Israel, Dec 20 2016
  • Mathematica
    a[n_] := Module[{p, R, V, W, k, v, r}, p = Prime[n]; R = Union @ Table[ PowerMod[2, i, p], {i, 0, MultiplicativeOrder[2, p]-1}]; Rm = p - R; V = R; W = V; For[k = 2, True, k++, If[Length[V ~Intersection~ Rm] > 0, Return[k]]; V = Union@ Flatten@ Table[Table[v + Mod[r, p], {v, V}], {r, R}] ~Complement~ W; {W, W ~Union~ V}]];
    a[1] = 1;
    Array[a, 100] (* Jean-François Alcover, Jun 08 2020, after Robert Israel *)
  • PARI
    a(n,p=prime(n))=my(o=znorder(Mod(2,p)), v1=Set(powers(Mod(2,p),o)), v=v1, s=1); while(!setsearch(v,Mod(0,p)), v=setbinop((x,y)->x+y,v,v1); s++); s

Formula

a(n) = A000120(A278967(n)). In particular, a(n) = A000120(prime(n)) whenever prime(n) is in A143027. - Max Alekseyev, May 22 2025

A278968 Least number k such that pk is of minimal Hamming weight, where p is the n-th prime.

Original entry on oeis.org

1, 1, 1, 1, 3, 5, 1, 27, 3, 565, 1, 7085, 25, 3, 11, 1266205, 9099507, 17602325, 128207979, 119, 1, 13
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • PARI
    min1s(p)=my(o=znorder(Mod(2,p)), v1=Set(powers(Mod(2,p),o)), v=v1, s=1); while(!setsearch(v,Mod(0,p)), v=setbinop((x,y)->x+y,v,v1); s++); s
    a(n,p=prime(n))=my(m=min1s(p),t=p,k=2*p); while(hammingweight(t)>m, t+=k); t/p
Showing 1-2 of 2 results.