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 38 results. Next

A227643 a(0)=1; for n > 0, a(n) = 1 + Sum_{i=A228086(n)..A228087(n)} [A092391(i) = n]*a(i), where [] is the Iverson bracket, resulting in 1 when i + A000120(i) = n and 0 otherwise.

Original entry on oeis.org

1, 1, 2, 3, 1, 5, 1, 6, 2, 3, 7, 4, 8, 1, 13, 1, 2, 16, 1, 18, 2, 1, 21, 1, 2, 22, 3, 2, 23, 4, 1, 26, 1, 6, 2, 7, 29, 1, 37, 1, 2, 38, 3, 2, 39, 4, 1, 42, 1, 5, 3, 1, 48, 4, 1, 50, 1, 5, 2, 2, 51, 6, 3, 1, 54, 55, 7, 59, 8, 2, 68, 1, 3, 69, 4, 2, 70, 5, 1, 73, 1
Offset: 0

Views

Author

Andres M. Torres, Jul 18 2013

Keywords

Comments

Each a(n) = 1 + the count of nodes in the finite subtree defined by the edge relation parent = child + A000120(child). In other words, one more than the count of n's descendants, by which we mean the whole transitive closure of all children emanating from the parent at n. The subtree is finite because successive descendant values get smaller and approach zero.

Examples

			0 has no children distinct from itself (we only have A092391(0)=0), so we define a(0) = (0+1) = 1,
1 has no children (it is one of the terms of A010061), so a(1) = (0+1) = 1,
4 and 6 are also members of A010061, so both a(4) and a(6) = (0+1) = 1,
7 has 1,2,3,4 and 5 among its descendants (as A092391(5)=7, A092391(3)=A092391(4)=5, A092391(2)=3, A092391(1)=2), so a(7) = (5+1) = 6,
8 has 6 as a child value,        so a(8) = (1+1) = 2,
9 has 6 and 8 as descendants,    so a(9) = (2+1) = 3,
10 has {1,2,3,4,5,7}             so a(10) = (6+1) = 7.
		

Crossrefs

Cf. A010061 (gives the positions of ones), A000120, A092391, A228082, A228083, A228085, A227359, A227361, A227408.
Cf. also A213727 for a descendant counts for a similar tree defined by the edge relation parent = child - A000120(child).

Programs

  • Scheme
    ;; A deficient definition which works only up to n=128:
    (definec (A227643deficient n) (cond ((zero? n) 1) ((zero? (A228085 n)) 1) ((= 1 (A228085 n)) (+ 1 (A227643deficient (A228086 n)))) ((= 2 (A228085 n)) (+ 1 (A227643deficient (A228086 n)) (A227643deficient (A228087 n)))) (else (error "Not yet implemented for cases where n has more than two immediate children!"))))
    ;; Another definition that works for all n, but is somewhat slower:
    (definec (A227643full n) (cond ((zero? n) 1) (else (+ 1 (add (lambda (i) (if (= (A092391 i) n) (A227643full i) 0)) (A228086 n) (A228087 n))))))
    ;; Auxiliary function add implements sum_{i=lowlim..uplim} intfun(i)
    (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
    ;; by Antti Karttunen, Aug 16 2013, macro definec can be found in his IntSeq-library.

Formula

From Antti Karttunen, Aug 16 2013: (Start)
a(0)=1; and for n > 0, if A228085(n)=0 then a(n)=1; if A228085(n)=1 then a(n)=1+a(A228086(n)); if A228085(n)=2 then a(n)=1+a(A228086(n))+a(A228087(n)); otherwise (when A228085(n)>2) cannot be computed with this formula, which works only up to n=128.
a(0)=1; and for n > 0, a(n) = 1+Sum_{i=A228086(n)..A228087(n)} [A092391(i) = n]*a(i). (Here [...] denotes the Iverson bracket, resulting in 1 when i+A000120(i) = n and 0 otherwise. This formula works with all n.) (End)

A320840 Smallest N such that A092391(k) >= n for all k >= N.

Original entry on oeis.org

0, 1, 1, 2, 3, 3, 5, 5, 6, 7, 9, 9, 10, 11, 11, 13, 13, 14, 17, 17, 18, 19, 19, 21, 21, 22, 23, 25, 25, 26, 27, 27, 29, 29, 33, 33, 34, 35, 35, 37, 37, 38, 39, 41, 41, 42, 43, 43, 45, 45, 46, 49, 49, 50, 51, 51, 53, 53, 54, 55, 57, 57, 58, 59, 59, 61, 65, 65
Offset: 0

Views

Author

Jianing Song, Oct 22 2018

Keywords

Comments

For n >= 2, a(n) <= n - 1, and is exactly n - 1 for all n = 2^t + 2.
Consider the diverging sum Sum_{k>=0} 4^k/k!. For k >= a(n), v(4^k/k!, 2) = A092391(k) >= n. As a result, the sum contains only finitely many nonzero terms (and thus converges) modulo 2^n for all n, that is, it converges in the 2-adic field. Here v(k, 2) is the 2-adic valuation of k.

Examples

			a(33) = 29 because A092391(28) = 31 < 33, A092391(29) = 33, A092391(30) = 34, A092391(31) = 36 and A092391(32) = 33. The smallest N such that A092391(k) >= 33 for all k >= N is N = 29.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{i = n-1-Boole[n >= 2]}, While[i+Total[IntegerDigits[i, 2]] >= n, i--]; i+1]; a[0]=0; Table[a[n], {n, 0, 67}] (* Jean-François Alcover, Nov 23 2018, from PARI *)
  • PARI
    a(n) = if(n, my(i=n-1-(n>=2)); while(i+hammingweight(i)>=n, i--); i+1, 0)

A354254 a(n) is the least m >= 0 such that n = f^k(m) for some k >= 0 (where f^k denotes the k-th iterate of A092391).

Original entry on oeis.org

0, 1, 1, 1, 4, 1, 6, 1, 6, 6, 1, 6, 1, 13, 1, 15, 13, 1, 18, 1, 18, 21, 1, 23, 21, 1, 21, 23, 1, 21, 30, 1, 32, 21, 30, 21, 1, 37, 1, 39, 37, 1, 37, 39, 1, 37, 46, 1, 48, 37, 46, 51, 1, 46, 54, 1, 56, 46, 54, 56, 1, 46, 54, 63, 1, 1, 46, 1, 46, 63, 1, 71, 63
Offset: 0

Views

Author

Rémy Sigrist, May 21 2022

Keywords

Examples

			The first terms, alongside f(n), are:
  n   a(n)  f(n)
  --  ----  ----
   0     0     0
   1     1     2
   2     1     3
   3     1     5
   4     4     5
   5     1     7
   6     6     8
   7     1    10
   8     6     9
   9     6    11
  10     1    12
  11     6    14
  12     1    14
  13    13    16
  14     1    17
		

Crossrefs

Programs

  • PARI
    a = vector(73, n, n-1); for (n=0, #a-1, m=n+hammingweight(n); if (m<#a, a[1+m]=min(a[1+n],a[1+m]))); print (a)

Formula

a(n) = n iff n = 0 or n belongs to A010061.
a(n) = 1 iff n belongs to A010062.

A010061 Binary self or Colombian numbers: numbers that cannot be expressed as the sum of distinct terms of the form 2^k+1 (k>=0), or equivalently, numbers not of form m + sum of binary digits of m.

Original entry on oeis.org

1, 4, 6, 13, 15, 18, 21, 23, 30, 32, 37, 39, 46, 48, 51, 54, 56, 63, 71, 78, 80, 83, 86, 88, 95, 97, 102, 104, 111, 113, 116, 119, 121, 128, 130, 133, 135, 142, 144, 147, 150, 152, 159, 161, 166, 168, 175, 177, 180, 183, 185, 192, 200, 207, 209, 212, 215, 217
Offset: 1

Views

Author

Keywords

Comments

No two consecutive values appear in this sequence (see Links). - Griffin N. Macris, May 31 2020
The asymptotic density of this sequence is (1/8) * (2 - Sum_{n>=1} 1/2^a(n))^2 = 0.252660... (A242403). - Amiram Eldar, Nov 28 2020

References

  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.24, pp. 179-180.
  • József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, Chapter 4, pp. 384-386.
  • G. Troi and U. Zannier, Note on the density constant in the distribution of self-numbers, Bolletino U. M. I. (7) 9-A (1995), 143-148.

Crossrefs

Complement of A228082, or equally, numbers which do not occur in A092391. Gives the positions of zeros (those occurring after a(0)) in A228085-A228087 and positions of ones in A227643. Leftmost column of A228083. Base-10 analog: A003052.

Programs

  • Haskell
    a010061 n = a010061_list !! (n-1)
    a010061_list = filter ((== 0) . a228085) [1..]
    -- Reinhard Zumkeller, Oct 13 2013
    
  • Maple
    # For Maple code see A230091. - N. J. A. Sloane, Oct 10 2013
  • Mathematica
    Table[n + Total[IntegerDigits[n, 2]], {n, 0, 300}] // Complement[Range[Last[#]], #]& (* Jean-François Alcover, Sep 03 2013 *)
  • PARI
    /* Gen(n, b) returns a list of the generators of n in base b. Written by Max Alekseyev (see Alekseyev et al., 2021).
    For example, Gen(101, 10) returns [91, 101]. - N. J. A. Sloane, Jan 02 2022 */
    { Gen(u, b=10) = my(d, m, k);
      if(u<0 || u==1, return([]); );
      if(u==0, return([0]); );
      d = #digits(u, b)-1;
      m = u\b^d;
      while( sumdigits(m, b) > u - m*b^d,
        m--;
        if(m==0, m=b-1; d--; );
      );
      k = u - m*b^d - sumdigits(m, b);
      vecsort( concat( apply(x->x+m*b^d, Gen(k, b)),
                       apply(x->m*b^d-1-x, Gen((b-1)*d-k-2, b)) ) );
    }

Extensions

More terms from Antti Karttunen, Aug 17 2013
Better definition from Matthew C. Russell, Oct 08 2013

A010062 a(0)=1; thereafter a(n+1) = a(n) + number of 1's in binary representation of a(n).

Original entry on oeis.org

1, 2, 3, 5, 7, 10, 12, 14, 17, 19, 22, 25, 28, 31, 36, 38, 41, 44, 47, 52, 55, 60, 64, 65, 67, 70, 73, 76, 79, 84, 87, 92, 96, 98, 101, 105, 109, 114, 118, 123, 129, 131, 134, 137, 140, 143, 148, 151, 156, 160, 162, 165, 169, 173, 178, 182, 187, 193, 196, 199, 204
Offset: 0

Views

Author

Leonid Broukhis, Mar 15 1996

Keywords

Comments

Sequence A230297 (and A157845 without initial term) converted from binary to decimal, cf. formula. - M. F. Hasler, Nov 18 2019

Examples

			a(7) = 14 because a(6) = 12, which is 1100 in binary (having 2 on bits), and 12 + 2 = 14.
a(8) = 17 because a(7) = 14, which is 1110 in binary (having 3 on bits), and 14 + 3 = 17.
		

Crossrefs

First row of A228083.
For the base-10 analog see A004207.
Cf. A000120, A010061, A092391, A229167, A096303, A229743, A229744, A230297 (this sequence written in binary), A230298 (read mod 2).
See A230088 for partial sums.
Equals A028897 o A230297 = A028897 o A157845 (up to offset); see also A007088.

Programs

Formula

a(n) = (n/2)*log n + O(n*sqrt(log n * loglog n)), where log means log_2. In particular, a(n) ~ (n/2)*log n. [Stolarsky]
a(n + 1) = A092391(a(n)) = a(n) + A000120(a(n)). - Reinhard Zumkeller, May 27 2012, May 08 2004; corrected thanks to a notice by Lambert Herrgesell
a(n) = A028897(A230297(n)) = A028897(A157845(n+1)). - M. F. Hasler, Nov 18 2019

Extensions

More terms from Benoit Cloitre, Jun 02 2002
Stolarsky reference from Matthew C. Russell, Oct 08 2013

A228085 a(n) = number of distinct k which satisfy n = k + wt(k), where wt(k) (A000120) gives the number of 1's in binary representation of a nonnegative integer k.

Original entry on oeis.org

1, 0, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 2, 1, 1, 2, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 2, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 2, 0, 2, 1, 0
Offset: 0

Views

Author

Antti Karttunen, Aug 09 2013

Keywords

Comments

wt(k) is also called bitcount(k).
a(n) = number of times n occurs in A092391.
The first 2 occurs at n = A230303(2) = 5 (as we have two solutions A092391(3) = A092391(4) = 5).
The first 3 occurs at n = A230303(3) = 129 (as we have three solutions A092391(123) = A092391(124) = A092391(128) = 129).
The first 4 occurs at n = A230303(4) = 4102, where we have solutions A092391(4091) = A092391(4092) = A092391(4099) = A092391(4100) = 4102.
For n>=1, a(2^n) = a(n-1) since an integer k = m is a solution to n-1 = m + wt(m) if and only if k = 2^n - 1 - m is a solution to 2^n = k + wt(k). - Max Alekseyev, Feb 23 2021

Crossrefs

A010061 gives the position of zeros, A228082 the positions of nonzeros, A228088 the positions of ones.
Cf. A000120, A010062, A092391, A228086, A228087, A228091 (positions of 2's), A227643, A230058, A230092 (positions of 3's), A230093, A227915 (positions of 4's), A070939, A230303.

Programs

  • Haskell
    a228085 n = length $ filter ((== n) . a092391) [n - a070939 n .. n]
    -- Reinhard Zumkeller, Oct 13 2013
  • Maple
    For Maple code see A230091. - N. J. A. Sloane, Oct 10 2013
    # Find all inverses of m under x -> x + wt(x) - N. J. A. Sloane, Oct 19 2013
    A000120 := proc(n) local w, m, i; w := 0; m := n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end: wt := A000120;
    F:=proc(m) local ans,lb,n,i;
    lb:=m-ceil(log(m+1)/log(2)); ans:=[];
    for n from max(1,lb) to m do if (n+wt(n)) = m then ans:=[op(ans),n]; fi; od:
    [seq(ans[i],i=1..nops(ans))];
    end;
  • Mathematica
    nmax = 8191; Clear[a]; a[_] = 0;
    Scan[Set[a[#[[1]]], #[[2]]]&, Tally[Table[n + DigitCount[n, 2, 1], {n, 0, nmax}]]];
    a /@ Range[0, nmax] (* Jean-François Alcover, Oct 29 2019 *)
    a[n_] := Module[{k, cnt = 0}, For[k = n - Floor[Log[2, n]] - 1, k < n, k++, If[n == k + DigitCount[k, 2, 1], cnt++]]; cnt];
    a /@ Range[0, 100] (* Jean-François Alcover, Nov 28 2020 *)

A228082 Numbers that are of the form k + sum of binary digits of k for some nonnegative integer k.

Original entry on oeis.org

0, 2, 3, 5, 7, 8, 9, 10, 11, 12, 14, 16, 17, 19, 20, 22, 24, 25, 26, 27, 28, 29, 31, 33, 34, 35, 36, 38, 40, 41, 42, 43, 44, 45, 47, 49, 50, 52, 53, 55, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 79, 81, 82, 84, 85, 87, 89, 90
Offset: 1

Views

Author

Antti Karttunen, Aug 09 2013

Keywords

Comments

Complement of A010061.
Obtained when A092391 is sorted and duplicates are removed.
The asymptotic density of this sequence is 1 - (1/8) * (Sum_{n>=1} 1/2^a(n))^2 = 1 - A242403 = 0.747339... - Amiram Eldar, Nov 28 2020

References

  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.24, pp. 179-180.
  • József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, Chapter 4, p. 384-386.
  • G. Troi and U. Zannier, Note on the density constant in the distribution of self-numbers, Bolletino U. M. I. (7) 9-A (1995), 143-148.

Crossrefs

Numbers that occur to the right of the leftmost column of A228083. Positions of nonzeros in A228085. A superset of A228088.
The even terms are the first row of A350601.

Programs

  • Haskell
    a228082 n = a228082_list !! (n-1)
    a228082_list = 0 : filter ((> 0) . a228085) [1..]
    -- Reinhard Zumkeller, Oct 13 2013
  • Mathematica
    Table[n + Total[IntegerDigits[n, 2]], {n, 0, 100}] // Union (* Jean-François Alcover, Sep 03 2013 *)

A228088 Numbers n for which there is a unique k which satisfies n = k + wt(k), where wt(k) (A000120) gives the number of 1's in binary representation of nonnegative integer k.

Original entry on oeis.org

0, 2, 3, 7, 8, 9, 10, 11, 12, 16, 20, 24, 25, 26, 27, 28, 29, 34, 35, 40, 41, 42, 43, 44, 45, 49, 53, 57, 58, 59, 60, 61, 62, 65, 66, 68, 69, 72, 73, 74, 75, 76, 77, 81, 85, 89, 90, 91, 92, 93, 94, 99, 100, 105, 106, 107, 108, 109, 110, 114, 118, 122, 123, 124
Offset: 1

Views

Author

Antti Karttunen, Aug 09 2013

Keywords

Comments

wt(k) = A000120(k) is also called bitcount(k).
In other words, the positions of ones in A228085.
Numbers that can be expressed as the sum of distinct terms of the form 2^n+1, n=0,1,... in exactly one way. - Matthew C. Russell, Oct 08 2013

Examples

			0 is in this sequence because there is a unique k such that k+A000120(k)=0, in this case k=0.
1 is not in this sequence because there is no such k that k+A000120(k) would be 1. (Instead 1 is in A010061).
2 is in this sequence because there is exactly one k that satisfies k+A000120(k)=2, namely k=1.
3 is in this sequence because there is exactly one k that satisfies k+A000120(k)=3, namely k=2.
4 is not in this sequence because there is no such k that k+A000120(k) would be 4. (Instead 4 is in A010061.)
5 is not in this sequence because there is more than one k that satisfies k+A000120(k)=5, namely k=3 and k=4.
		

Crossrefs

Subset of A228082.
Cf. A228089 (corresponding k's for each a(n)).
Cf. A228090 (the same k's sorted into ascending order).
Cf. A227915.

Programs

Formula

a(n) = A092391(A228089(n)). [Consequence of the definitions of A228088 & A228089. Use the given Scheme-code to actually compute the sequence]

A230099 a(n) = n + (product of digits of n).

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 50, 56, 62, 68, 74, 80, 86, 92, 98, 104, 60, 67, 74, 81, 88, 95, 102, 109, 116, 123, 70, 78, 86, 94, 102, 110, 118, 126
Offset: 0

Views

Author

N. J. A. Sloane, Oct 12 2013

Keywords

Comments

A230099, A063114, A098736, A230101 are analogs of A092391 and A062028.

Crossrefs

Programs

  • Haskell
    a230099 n = a007954 n + n  -- Reinhard Zumkeller, Oct 13 2013
    
  • Maple
    with transforms; [seq(n+digprod(n), n=0..200)];
  • PARI
    a(n) = if (n, n + vecprod(digits(n)), 0); \\ Michel Marcus, Dec 18 2018
    
  • Python
    from math import prod
    def a(n): return n + prod(map(int, str(n)))
    print([a(n) for n in range(78)]) # Michael S. Branicky, Jan 09 2023

Formula

a(n) = n iff n contains a digit 0 (A011540). - Bernard Schott, Jul 31 2023

A230092 Numbers of the form k + wt(k) for exactly three distinct k, where wt(k) = A000120(k) is the binary weight of k.

Original entry on oeis.org

129, 134, 386, 391, 515, 518, 642, 647, 899, 904, 1028, 1030, 1154, 1159, 1411, 1416, 1540, 1543, 1667, 1672, 1924, 1929, 2178, 2183, 2435, 2440, 2564, 2567, 2691, 2696, 2948, 2953, 3077, 3079, 3203, 3208, 3460, 3465, 3589, 3592, 3716, 3721, 3973, 3978, 4226
Offset: 1

Views

Author

N. J. A. Sloane, Oct 10 2013

Keywords

Comments

The positions of entries equal to 3 in A228085, or numbers that appear exactly thrice in A092391.
Numbers that can be expressed as the sum of distinct terms of the form 2^n+1, n=0,1,... in exactly three ways.

Crossrefs

Programs

  • Haskell
    a230092 n = a230092_list !! (n-1)
    a230092_list = filter ((== 3) . a228085) [1..]
    -- Reinhard Zumkeller, Oct 13 2013
  • Maple
    For Maple code see A230091.
  • Mathematica
    nt = 1000; (* number of terms to produce *)
    S[kmax_] := S[kmax] = Table[k + Total[IntegerDigits[k, 2]], {k, 0, kmax}] // Tally // Select[#, #[[2]] == 3&][[All, 1]]& // PadRight[#, nt]&;
    S[nt];
    S[kmax = 2 nt];
    While[S[kmax] =!= S[kmax/2], kmax *= 2];
    S[kmax] (* Jean-François Alcover, Mar 04 2023 *)
Showing 1-10 of 38 results. Next