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.

Previous Showing 61-70 of 73 results. Next

A117891 Numbers k such that both the number of non-leading 0's in the binary representation of k and the number of 1's in the binary representation of k divide k.

Original entry on oeis.org

2, 4, 6, 10, 12, 16, 18, 24, 36, 40, 42, 48, 55, 60, 80, 84, 108, 110, 120, 126, 132, 144, 156, 172, 180, 184, 192, 204, 212, 216, 222, 228, 232, 240, 246, 252, 256, 276, 300, 318, 324, 336, 340, 360, 366, 378, 414, 420, 438, 440, 444, 460, 462, 474, 480, 486
Offset: 1

Views

Author

Leroy Quet, Mar 30 2006

Keywords

Examples

			24 is 11000 in binary. This binary representation has three 0's and 3 divides 24. Also, the binary representation has two 1's and 2 also divides 24. So 24 is in the sequence.
		

Crossrefs

Cf. A049445, A117890. Includes A001146.

Programs

  • C
    #include 
    int main(int argc, char *argv[]) { for(int n=1; n< 500 ; n++) { int digs[2] ; int nshifted=n ; digs[0]=digs[1]=0 ; while(nshifted) { digs[ nshifted & 1]++ ; nshifted >>= 1 ; } if ( digs[0] && digs[1]) if( ( n % digs[0]) == 0 && (n %digs[1]) ==0) printf("%d,",n) ; } } /* R. J. Mathar, Apr 03 2006 */
  • Maple
    filter:= proc(n) local L, x,m;
      L:= convert(n,base,2);
      x:= convert(L,`+`);
      m:= nops(L);
      x < m and n mod x = 0 and n mod (m-x) = 0
    end proc:
    select(filter, [$1..1000]);
  • Mathematica
    bdQ[n_]:=Module[{idn2=IntegerDigits[n,2],x,y},x=Count[idn2,1];y=Count[ idn2,0]; If[x==0,x=n+1];If[y==0,y=n+1];And@@Divisible[n,{x,y}]]; Select[ Range[500],bdQ] (* Harvey P. Dale, Jan 22 2012 *)

Extensions

More terms from R. J. Mathar, Apr 03 2006

A180468 Numbers n such that n/k is an integer. n=(x_1 x_2 ... x_r) where x_i are digits of n, k = x_1^r + x_2^(r-1) + ... + x_r^1.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 24, 48, 50, 100, 102, 108, 110, 111, 112, 114, 117, 120, 130, 132, 135, 155, 164, 200, 204, 208, 221, 224, 240, 243, 336, 414, 476, 500, 512, 762
Offset: 1

Views

Author

Ctibor O. Zizka, Sep 06 2010

Keywords

Comments

n=48, k=4^2+8^1=24, n/k=2 so 48 belongs to the sequence. For binary numbers we have the sequence of n-s such that n/(1-s counting sequence) is an integer, this is A049445.

Crossrefs

Programs

  • Mathematica
    Join[{0},Select[Range[800],Divisible[#,Total[IntegerDigits[#]^ Reverse[ Range[ IntegerLength[ #]]]]]&]] (* Harvey P. Dale, Dec 03 2018 *)

A226171 Smallest base in which n is not Niven (or zero if n is Niven in every base).

Original entry on oeis.org

0, 0, 2, 0, 2, 0, 2, 6, 2, 4, 2, 8, 2, 2, 2, 6, 2, 8, 2, 7, 5, 2, 2, 14, 2, 2, 2, 2, 2, 2, 2, 6, 2, 3, 2, 8, 2, 2, 2, 12, 2, 3, 2, 2, 2, 2, 2, 14, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 8, 2, 2, 2, 6, 2, 3, 2, 3, 3, 2, 2, 14, 2, 2, 2, 2, 2, 2, 2, 8, 5, 2, 2, 5, 2, 2
Offset: 1

Views

Author

Sergio Pimentel, May 29 2013

Keywords

Comments

Niven numbers (in base b) are divisible by the sum of their digits (in base b).
Questions: are 1, 2, 4 and 6 the only zeros in this sequence? Where are the records or high water marks?
From Bert Dobbelaere, Oct 08 2018: (Start)
1,2,4,6 are the only numbers that are Niven in every base.
Proof: Suppose n is Niven in every base, then consider the base-b representations of n for (n/2) < b <= n. These are all 2-digit numbers with 1 as 1st digit and (n-b) as last digit. Then 1+n-b is a divisor of n for all b, meaning that all numbers between 1 up to n/2 are divisors of n. Clearly there are no such numbers larger than 6.
a(n) < 60 for n < 10^13.
(End)

Examples

			The sum of digits of 24 in bases 1 through 14 are:  24, 2, 4, 3, 8, 4, 6, 3, 8, 6, 4, 2, 12, 11.  24 is divisible by all these numbers except the last one; therefore a(24) = 14.
		

Crossrefs

Cf. A225427 (least Niven number for all bases from 1 to n).

Programs

  • Mathematica
    Table[b = 2; While[s = Total[IntegerDigits[n, b]]; s < n && Mod[n, s] == 0, b++]; If[s == n, b = 0]; b, {n, 100}] (* T. D. Noe, May 30 2013 *)
  • PARI
    a(n) = {for (b=2, n-1, if (frac(n/sumdigits(n,b)), return(b));); 0;} \\ Michel Marcus, Oct 23 2018

A334529 Numbers that are both binary palindromes and binary Niven numbers.

Original entry on oeis.org

1, 21, 273, 4161, 22517, 28347, 65793, 69905, 81913, 87381, 106483, 109483, 121143, 292721, 299593, 317273, 319449, 350933, 354101, 368589, 378653, 421811, 470951, 479831, 1049601, 1135953, 1171313, 1172721, 1208009, 1257113, 1269593, 1295481, 1332549, 1371877
Offset: 1

Views

Author

Amiram Eldar, May 05 2020

Keywords

Examples

			21 is a term since its binary representation, 10101, is palindromic, and 1 + 0 + 1 + 0 + 1 = 3 is a divisor of 21.
		

Crossrefs

Intersection of A006995 and A049445.
Cf. A082232.

Programs

  • Mathematica
    Select[Range[10^6], PalindromeQ[(d = IntegerDigits[#, 2])] && Divisible[#, Plus @@ d] &]
  • Python
    def ok(n): b = bin(n)[2:]; return b==b[::-1] and n%sum(map(int, b)) == 0
    def aupto(nn): return [m for m in range(1, nn+1) if ok(m)]
    print(aupto(1371877)) # Michael S. Branicky, Jan 21 2021

A334531 Numbers that are both binary Niven numbers and binary Smith numbers.

Original entry on oeis.org

55, 185, 205, 222, 246, 438, 623, 822, 973, 1503, 1939, 2359, 2471, 3126, 3205, 3462, 3573, 3661, 3771, 3846, 4711, 5877, 5949, 6093, 6198, 6655, 6918, 7083, 7550, 7931, 8151, 8170, 9567, 9863, 10265, 10683, 11241, 12280, 12318, 12486, 12678, 13695, 13790, 13820
Offset: 1

Views

Author

Amiram Eldar, May 05 2020

Keywords

Examples

			The binary representation of 55 is 110111. It is a binary Niven number since 1 + 1 + 0 + 1 + 1 + 1 = 5 is a divisor of 55. It is also a binary Smith number since its prime factorization, 5 * 11, is 101 * 1011 in binary representation, and 1 + 1 + 0 + 1 + 1 + 1 = (1 + 0 + 1) + (1 + 0 + 1 + 1). Thus 55 is a term.
		

Crossrefs

Intersection of A049445 and A278909.
Cf. A334527.

Programs

  • Mathematica
    binWt[n_] := DigitCount[n, 2, 1]; binNivenSmithQ[n_] := Divisible[n, (bw = binWt[n])] && CompositeQ[n] && Plus @@ (Last@# * binWt[First@#] & /@ FactorInteger[n]) == bw; Select[Range[10^4], binNivenSmithQ]

A363789 a(n) is the smallest primitive binary Niven number (A363787) whose binary representation is ending with n zeros.

Original entry on oeis.org

1, 6, 60, 2040, 1048560, 137438953440, 1180591620717411303360, 43556142965880123323311949751266331066240, 29642774844752946028434172162224104410437116074403984394101141506025761187823360
Offset: 0

Views

Author

Amiram Eldar, Jun 22 2023

Keywords

Comments

The least term k of A363787 such that A007814(k) = n.
Also, the least binary Niven number (A049445) with a binary weight (A000120) that equals 2^n.
The next term, a(9) = 6.864... * 10^156, is too long to include in the Data section.

Crossrefs

Subsequence of A049445, A143115 and A363787.
Cf. A000120, A007814, A066524, A358256 (decimal analog).

Programs

  • Mathematica
    a[n_] := (2^(2^n)-1) * 2^n; Array[a, 9, 0]
  • PARI
    a(n) = (2^(2^n)-1) * 2^n;

Formula

a(n) = (2^(2^n)-1) * 2^n = A066524(2^n).
a(n) = A143115(2^n).

A376618 Odd binary Niven numbers (A144302) k such that k/wt(k) is also an odd binary Niven number, where wt(k) = A000120(k) is the binary weight of k.

Original entry on oeis.org

1, 345, 405, 775, 1305, 1425, 1435, 1605, 2125, 2325, 2485, 2765, 2825, 4235, 4305, 4459, 4655, 4725, 5085, 5145, 5607, 5625, 5929, 6223, 6405, 7515, 7623, 8145, 10625, 11151, 11835, 12325, 12355, 12425, 13527, 13825, 13995, 14805, 16695, 18445, 20505, 20625, 20925
Offset: 1

Views

Author

Amiram Eldar, Sep 30 2024

Keywords

Comments

If m is a term then 2^k * m is a term of A376616 for all k >= 0.

Examples

			345 is a term since it is odd, 345/wt(345) = 69 is an integer, and 69/wt(69) = 23 is an integer.
		

Crossrefs

Intersection of A005408 and A376616.
Subsequence of A049445 and A144302.
Cf. A000120.

Programs

  • Mathematica
    q[k_] := Module[{w = DigitCount[k, 2, 1]}, Divisible[k, w] && Divisible[k/w, DigitCount[k/w, 2, 1]]]; Select[Range[1, 21000, 2], q]
  • PARI
    is(k) = if(!(k % 2), 0, my(w = hammingweight(k)); !(k % w) && !((k/w) % hammingweight(k/w)));

A334532 Binary palindromic numbers that are also binary Niven and binary Smith numbers.

Original entry on oeis.org

22517, 317273, 5876429, 7129499, 18659953, 20053785, 24328605, 28676955, 31134135, 88700053, 92254197, 95682157, 96316909, 97462173, 117812487, 120026919, 120303271, 120323751, 128167471, 133396095, 133984767, 292610513, 309416393, 314572713, 348580965, 351400421
Offset: 1

Views

Author

Amiram Eldar, May 05 2020

Keywords

Examples

			The binary representation of 22517 is 101011111110101 which is palindromic. The number of 1's in its binary representation is 11 which is a divisor of 22517, hence 22517 is a binary Niven. It is also a binary Smith number since its prime factorization, 11 * 23 * 89, is 1011 * 10111 * 1011001 in binary representation, and (1 + 0 + 1 + 1) + (1 + 0 + 1 + 1 + 1) + (1 + 0 + 1 + 1 + 0 + 0 + 1) = 3 + 4 + 4 = 11 is equal to the number of 1's in its binary representation.
		

Crossrefs

Intersection of A006995, A049445 and A278909.
Intersection of any two of the sequences A334529, A334530 and A334531.
Cf. A334528.

Programs

  • Mathematica
    binWt[n_] := DigitCount[n, 2, 1]; binPalNivenSmithQ[n_] := Divisible[n, (bw = Plus @@ (d = IntegerDigits[n, 2]))] && PalindromeQ[d] && CompositeQ[n] && Plus @@ (Last@# * binWt[First@#] & /@ FactorInteger[n]) == bw; Select[Range[2*10^6], binPalNivenSmithQ]

A348416 For n >= 1; a(n) = gcd(n,w(n)) where w(n) is the binary weight of n, A000120(n).

Original entry on oeis.org

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

Views

Author

Ctibor O. Zizka, Oct 19 2021

Keywords

Comments

a(n) is even for n in A125592, a(n) = 1 for n in A094387.

Examples

			n = 6; gcd(6, A000120(6)) = 2, thus a(6) = 2.
		

Crossrefs

Programs

  • Mathematica
    Array[GCD[#, Total@ IntegerDigits[#, 2]] &, 105] (* Michael De Vlieger, Oct 19 2021 *)
  • PARI
    a(n) = gcd(n, hammingweight(n)); \\ Michel Marcus, Oct 19 2021

Formula

a(n) = gcd(n, A000120(n)).
a(n) = A000120(n) if and only if n is in A049445. - Amiram Eldar, Oct 19 2021

A358139 Numbers k > 0 sorted by k/A000120(k) in increasing order. A000120 is the binary weight of k. If k/A000120(k) yields equal values, the smaller k will appear first.

Original entry on oeis.org

1, 3, 2, 7, 5, 6, 11, 15, 4, 13, 9, 14, 10, 23, 12, 31, 19, 27, 21, 29, 22, 30, 8, 25, 17, 26, 18, 28, 47, 39, 20, 63, 43, 55, 45, 46, 35, 59, 24, 61, 37, 62, 38, 51, 53, 54, 41, 42, 57, 58, 44, 60, 79, 95, 16, 49, 33, 50, 34, 52, 87, 71, 36, 127, 91, 111, 93, 56
Offset: 1

Views

Author

Thomas Scheuerle, Oct 31 2022

Keywords

Comments

A permutation of the positive integers.
This permutation satisfies a weak ordering: If b = a(c*d) and e = a(c) and f = a(d) then b > e and b > f with c,d > 1.

Crossrefs

Programs

  • PARI
    f(x) = x/hammingweight(x);
    cmpb(x, y) = my(hx=f(x), hy=f(y)); if (hx != hy, return(sign(hx-hy))); return(sign(x-y));
    lista(nn) = Vec(vecsort([1..2*nn], cmpb, 1), nn); \\ Michel Marcus, Nov 05 2022

Formula

a(2^n) = 2^(n+1) - 1.
abs(a(n)-n) < n.
Previous Showing 61-70 of 73 results. Next