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.

A360981 a(n) is the least positive multiple of n that is an evil number (A001969).

Original entry on oeis.org

3, 6, 3, 12, 5, 6, 63, 24, 9, 10, 33, 12, 39, 126, 15, 48, 17, 18, 57, 20, 63, 66, 23, 24, 75, 78, 27, 252, 29, 30, 1023, 96, 33, 34, 105, 36, 111, 114, 39, 40, 123, 126, 43, 132, 45, 46, 141, 48, 147, 150, 51, 156, 53, 54, 165, 504, 57, 58, 177, 60, 183, 2046
Offset: 1

Views

Author

Rémy Sigrist, Feb 27 2023

Keywords

Comments

This sequence is well defined: for any n > 0, A020330(n) is both a multiple of n and an evil number.

Crossrefs

Cf. A001969, A020330, A180938, A360980 (variant for odious numbers).

Programs

  • Maple
    f:= proc(n) local k;
      for k from n by n do
        if convert(convert(k,base,2),`+`)::even then return k fi
      od
    end proc:
    map(f, [$1..100]); # Robert Israel, Mar 29 2023
  • Mathematica
    a[n_] := Module[{k = n}, While[OddQ[DigitCount[k, 2, 1]], k +=n]; k]; Array[a, 100] (* Amiram Eldar, Aug 07 2023 *)
  • PARI
    a(n) = { forstep (m=n, oo, n, if (hammingweight(m)%2==0, return (m))) }
    
  • Python
    def A360981(n):
        k = n
        while k.bit_count()&1:
            k += n
        return k # Chai Wah Wu, Feb 28 2023

Formula

a(n) = A180938(n) * n.
a(n) = n iff n belongs to A001969.

A351836 Smallest evil number k (member of A001969) such that k*n is also evil.

Original entry on oeis.org

3, 3, 3, 3, 3, 3, 9, 3, 3, 3, 3, 3, 3, 9, 3, 3, 3, 3, 3, 3, 3, 3, 9, 3, 3, 3, 5, 9, 15, 3, 33, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 9, 3, 3, 3, 3, 3, 3, 3, 5, 3, 9, 9, 15, 3, 3, 3, 33, 3, 3, 3, 3, 3, 3, 3, 3, 9, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 3, 3, 3
Offset: 1

Views

Author

Jeffrey Shallit, Feb 21 2022

Keywords

Comments

All terms are odd since if 2*j and 2*j*n are both evil, then so are j and j*n. - Michael S. Branicky, Feb 21 2022

Examples

			For n = 7 both 9 and 9*7 are evil and no smaller multiple of 7 works.
		

Crossrefs

Cf. A001969, A351835 (analog for the odious numbers A000069).
Cf. A180938 (where k is not necessarily evil).

Programs

  • Mathematica
    evilQ[n_] := EvenQ[DigitCount[n, 2, 1]]; a[n_] := Module[{k = 1}, While[!evilQ[k] || !evilQ[k*n], k++]; k]; Array[a, 100] (* Amiram Eldar, Feb 21 2022 *)
  • PARI
    isevil(m) = !(hammingweight(m) % 2);
    a(n) = my(k=1); while (!isevil(k) || !isevil(k*n), k++); k; \\ Michel Marcus, Feb 22 2022
  • Python
    def ev(n): return bin(n).count("1")%2 == 0
    def a(n):
        k = 3
        while not (ev(k) and ev(k*n)): k += 1
        return k
    print([a(n) for n in range(1, 87)]) # Michael S. Branicky, Feb 21 2022
    
Showing 1-2 of 2 results.