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 21-30 of 384 results. Next

A324287 a(n) = A002487(A005187(n)).

Original entry on oeis.org

0, 1, 2, 1, 3, 1, 3, 5, 4, 1, 4, 7, 5, 7, 7, 5, 5, 1, 5, 9, 7, 10, 11, 8, 7, 9, 9, 7, 13, 8, 3, 10, 6, 1, 6, 11, 9, 13, 15, 11, 10, 13, 14, 11, 21, 13, 5, 17, 9, 11, 11, 9, 19, 12, 5, 18, 19, 11, 3, 13, 7, 18, 15, 4, 7, 1, 7, 13, 11, 16, 19, 14, 13, 17, 19, 15, 29, 18, 7, 24, 13, 16, 17, 14, 30, 19, 8, 29, 31, 18, 5, 22, 12, 31, 26, 7
Offset: 0

Views

Author

Antti Karttunen, Feb 20 2019

Keywords

Comments

The motivation for this kind of sequence was a question: what kind of simply defined non-injective functions f exist such that this sequence can be defined as their function, e.g., as a(n) = g(f(n)), where g is a nontrivial integer-valued function? The same question can also be asked about A324288, A324337 and A324338. Note that A005187, A283477 and A006068 used in their definitions are all injections. Of course, A324377(n) = A000265(A005187(n)) fills the bill as A002487(n) = A002487(A000265(n)), but are there any less obvious solutions? - Antti Karttunen, Feb 28 2019

Crossrefs

Programs

  • PARI
    A002487(n) = { my(s=sign(n), a=1, b=0); n = abs(n); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (s*b); }; \\ Modified from the one given in A002487, sign not actually needed here.
    A005187(n) = { my(s=n); while(n>>=1, s+=n); s; };
    A324287(n) = A002487(A005187(n));
    
  • Python
    from functools import reduce
    def A324287(n): return sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin((n<<1)-n.bit_count())[-1:2:-1],(1,0))) if n else 0 # Chai Wah Wu, May 05 2023

Formula

a(n) = A002487(A005187(n)).
a(n) = A324286(A283477(n)).
a(n) = A002487(A324377(n)).

A324288 a(n) = A002487(1+A005187(n)).

Original entry on oeis.org

1, 1, 1, 3, 1, 4, 5, 2, 1, 5, 7, 3, 7, 2, 5, 8, 1, 6, 9, 4, 10, 3, 8, 13, 9, 2, 7, 12, 8, 11, 10, 7, 1, 7, 11, 5, 13, 4, 11, 18, 13, 3, 11, 19, 13, 18, 17, 12, 11, 2, 9, 16, 12, 17, 18, 13, 11, 14, 13, 10, 18, 11, 4, 13, 1, 8, 13, 6, 16, 5, 14, 23, 17, 4, 15, 26, 18, 25, 24, 17, 16, 3, 14, 25, 19, 27, 29, 21, 18, 23, 22, 17, 31, 19, 7, 23, 13, 2
Offset: 0

Views

Author

Antti Karttunen, Feb 20 2019

Keywords

Crossrefs

Programs

  • PARI
    A002487(n) = { my(s=sign(n), a=1, b=0); n = abs(n); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (s*b); }; \\ Modified from the one given in A002487, sign not actually needed here.
    A005187(n) = { my(s=n); while(n>>=1, s+=n); s; };
    A324288(n) = A002487(1+A005187(n));
    
  • Python
    from functools import reduce
    def A324288(n): return sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(1+(n<<1)-n.bit_count())[-1:2:-1],(1,0))) if n else 1 # Chai Wah Wu, May 05 2023

Formula

a(n) = A002487(1+A005187(n)).

A284013 a(n) = n - A002487(n).

Original entry on oeis.org

0, 0, 1, 1, 3, 2, 4, 4, 7, 5, 7, 6, 10, 8, 11, 11, 15, 12, 14, 12, 17, 13, 17, 16, 22, 18, 21, 19, 25, 22, 26, 26, 31, 27, 29, 26, 32, 26, 31, 29, 37, 30, 34, 30, 39, 33, 39, 38, 46, 40, 43, 39, 47, 40, 46, 44, 53, 47, 51, 48, 56, 52, 57, 57, 63, 58, 60, 56, 63, 55, 61, 58, 68, 58, 63, 57, 69, 60, 68, 66, 77, 67, 71, 64, 76, 64
Offset: 0

Views

Author

Antti Karttunen, Mar 23 2017

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] :=If[n<2, n, If[ EvenQ[n], a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]]; Table[n - a[n], {n , 0, 100}] (* Indranil Ghosh, Mar 23 2017 *)
  • PARI
    A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
    for(n=0, 151, print1(n - A(n),", ")) \\ Indranil Ghosh, Mar 23 2017
    
  • Python
    def a(n): return n if n<2 else (a(n//2) if n%2==0 else a((n - 1)//2) + a((n + 1)//2))
    print([n - a(n) for n in range(101)]) # Indranil Ghosh, Mar 23 2017
    
  • Python
    from functools import reduce
    def A284013(n): return n-sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0))) if n else 0 # Chai Wah Wu, May 18 2023
  • Scheme
    (define (A284013 n) (- n (A002487 n))) ;; Code for A002487 given under that entry.
    

Formula

a(n) = n - A002487(n).

A318307 Multiplicative with a(p^e) = 2^A002487(e).

Original entry on oeis.org

1, 2, 2, 2, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 4, 2, 2, 4, 2, 4, 4, 4, 2, 8, 2, 4, 4, 4, 2, 8, 2, 8, 4, 4, 4, 4, 2, 4, 4, 8, 2, 8, 2, 4, 4, 4, 2, 4, 2, 4, 4, 4, 2, 8, 4, 8, 4, 4, 2, 8, 2, 4, 4, 4, 4, 8, 2, 4, 4, 8, 2, 8, 2, 4, 4, 4, 4, 8, 2, 4, 2, 4, 2, 8, 4, 4, 4, 8, 2, 8, 4, 4, 4, 4, 4, 16, 2, 4, 4, 4, 2, 8, 2, 8, 8
Offset: 1

Views

Author

Antti Karttunen, Aug 29 2018

Keywords

Crossrefs

Differs from A037445 for the first time at n=32, where a(32) = 8, while A037445(32) = 4.

Programs

  • Mathematica
    f[m_] := Module[{a = 1, b = 0, n = m}, While[n > 0, If[OddQ[n], b += a, a += b]; n = Floor[n/2]]; b]; Array[Times @@ Map[2^f@ # &, FactorInteger[#][[All, -1]] ] - Boole[# == 1] &, 105] (* after Jean-François Alcover at A002487 *)
  • PARI
    A002487(n) = { my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (b); }; \\ From A002487
    A318307(n) = factorback(apply(e -> 2^A002487(e),factor(n)[,2]));
    
  • Python
    from functools import reduce
    from sympy import factorint
    def A318307(n): return 1<Chai Wah Wu, May 18 2023

Formula

a(n) = 2^A318306(n).
a(n) = A061142(A318470(n)).
a(n^2) = a(n).
a(A003557(n^2)) = A318316(n).
Dirichlet convolution square of A318667(n)/A317934(n).

A323892 Lexicographically earliest sequence such that a(i) = a(j) => A002487(i) = A002487(j) and A033879(i) = A033879(j), for all i, j >= 1.

Original entry on oeis.org

1, 1, 2, 1, 3, 4, 5, 1, 6, 7, 8, 9, 10, 3, 11, 1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 8, 21, 22, 23, 24, 25, 1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 35, 47, 48, 49, 50, 51, 52, 53, 54, 55, 1, 56, 57, 58, 8, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 47, 72, 73, 74, 75, 76, 77, 78, 79, 80, 31, 81
Offset: 1

Views

Author

Antti Karttunen, Feb 09 2019

Keywords

Comments

Restricted growth sequence transform of the ordered pair [A002487(n), A033879(n)].

Crossrefs

Cf. also A318310, A323889.

Programs

  • PARI
    up_to = 65537;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A002487(n) = { my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (b); }; \\ From A002487
    A033879(n) = (2*n-sigma(n));
    A323892aux(n) = [A002487(n), A033879(n)];
    v323892 = rgs_transform(vector(up_to,n,A323892aux(n)));
    A323892(n) = v323892[n];

Formula

a(2^n) = 1 for all n >= 0.

A323903 a(n) = A002487(A122111(n)).

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 3, 4, 2, 1, 3, 1, 2, 4, 3, 1, 4, 1, 3, 4, 2, 1, 3, 8, 2, 7, 3, 1, 4, 1, 5, 4, 2, 8, 8, 1, 2, 4, 3, 1, 4, 1, 3, 7, 2, 1, 5, 14, 12, 4, 3, 1, 9, 8, 3, 4, 2, 1, 8, 1, 2, 7, 5, 8, 4, 1, 3, 4, 12, 1, 6, 1, 2, 18, 3, 14, 4, 1, 5, 9, 2, 1, 8, 8, 2, 4, 3, 1, 9, 14, 3, 4, 2, 8, 5, 1, 16, 7, 6, 1, 4, 1, 3, 18
Offset: 1

Views

Author

Antti Karttunen, Feb 09 2019

Keywords

Crossrefs

Programs

  • PARI
    A002487(n) = { my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (b); }; \\ From A002487
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A122111(n) = if(1==n,n,prime(bigomega(n))*A122111(A064989(n)));
    A323903(n) = A002487(A122111(n));

Formula

a(n) = A002487(A122111(n)) = A002487(A322865(n)).
a(p) = 1 for all primes p.

A324115 a(n) = A002487(A323244(n)).

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 2, 0, 3, 1, 3, 1, 1, 1, 2, 1, 2, 1, 4, -2, 4, 1, 5, -1, 7, 1, 5, 1, 3, 1, 4, 3, 11, -1, 3, 1, 1, -2, 5, 1, 4, 1, 6, 1, 13, 1, 7, -2, 7, 1, 7, 1, 3, -7, 9, -2, 25, 1, 8, 1, 76, 1, 5, 3, 8, 1, 21, 7, 3, 1, 7, 1, 31, 3, 31, -3, 13, 1, 10, -2, 199, 1, 5, -4, 101, -18, 4, 1, 2, -12, 43, 11, 266, -5, 9, 1, 11, -1, 4, 1, 6, 1, 13
Offset: 1

Views

Author

Antti Karttunen, Feb 20 2019

Keywords

Comments

If there are no odd perfect numbers then A324201 gives the positions of all zeros after the initial a(1) = 0.

Crossrefs

Programs

  • PARI
    A002487(n) = if(abs(n)<=1, n, A002487(n\2) + if( n%2, A002487(n\2 + 1))); \\ This version works consistently also with negative arguments, so that a(-n) = -a(n). Except that it is very slow on large n.
    A002487(n) = { my(s=sign(n), a=1, b=0); n = abs(n); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (s*b); }; \\ So we use this one, modified from the one given in A002487
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n))));
    A323244(n) = if(1==n, 0, my(k=A156552(n)); (2*k)-sigma(k));
    A324115(n) = A002487(A323244(n));

Formula

a(n) = A002487(A323244(n)), with the definition of A002487 extended to the negative arguments so that A002487(-n) = -A002487(n).
a(A324201(n)) = 0.

A324116 a(n) = A002487(1+A323247(n)) = A324288(A156552(n)).

Original entry on oeis.org

1, 1, 1, 3, 1, 4, 1, 2, 5, 5, 1, 3, 1, 6, 7, 8, 1, 2, 1, 4, 9, 7, 1, 13, 7, 8, 5, 5, 1, 3, 1, 7, 11, 9, 10, 12, 1, 10, 13, 18, 1, 4, 1, 6, 8, 11, 1, 12, 9, 2, 15, 7, 1, 11, 13, 23, 17, 12, 1, 19, 1, 13, 11, 13, 16, 5, 1, 8, 19, 3, 1, 13, 1, 14, 7, 9, 13, 6, 1, 17, 10, 15, 1, 26, 19, 16, 21, 28, 1, 18, 17, 10, 23, 17, 22, 23, 1, 2
Offset: 1

Views

Author

Antti Karttunen, Feb 20 2019

Keywords

Comments

Like A323902, this also has quite a moderate growth rate, even though a certain subset of terms of A156552 soon grow quite big.

Crossrefs

Programs

  • PARI
    A002487(n) = { my(s=sign(n), a=1, b=0); n = abs(n); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (s*b); }; \\ So we use this one, modified from the one given in A002487
    A005187(n) = { my(s=n); while(n>>=1, s+=n); s; };
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n))));
    A324288(n) = A002487(1+A005187(n));
    A324116(n) = A324288(A156552(n));

Formula

a(n) = A002487(1+A323247(n)) = A324288(A156552(n)).
a(p) = 1 for all primes p.

A020946 a(n) is the smallest number k such that A002487(k) = n.

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 33, 19, 21, 35, 39, 37, 45, 43, 69, 73, 93, 77, 75, 83, 189, 85, 141, 139, 153, 151, 147, 155, 267, 149, 165, 173, 279, 275, 171, 283, 315, 277, 537, 325, 297, 293, 579, 301, 309, 365, 333, 299, 567, 331, 339, 553, 549, 563, 1275, 341, 585, 565, 615, 629
Offset: 0

Views

Author

N. J. A. Sloane and David W. Wilson, Jun 27 2002

Keywords

Examples

			A002487(33) = 6 and this is the first time 6 appears, so a(6) = 33.
		

Crossrefs

Programs

  • Mathematica
    aa = {}; a[0] = 0; a[1] = 1; a[n_] := a[n] = If[EvenQ[n], a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Do[k = 0; While[a[k] != p, k++]; AppendTo[aa, k], {p, 0, 100}]; aa (* Artur Jasinski, Dec 06 2010 *)
  • PARI
    fusc(n)={my(a=1, b=0);while(n,if(bitand(n, 1), b+=a, a+=b);n>>=1); b};
    list(N)={
        my(v=vector(N),k);
        forstep(n=1,9e99,2,
            k=fusc(n);
            if(k<=N && !v[k],
                v[k]=n;
                if(vecmin(v),return(v))
            )
        )
    }; \\ Charles R Greathouse IV, Dec 20 2011
    
  • Python
    from itertools import count
    from functools import reduce
    def A020946(n): return next(filter(lambda k:sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(k)[-1:2:-1],(1,0)))==n,count(1))) if n else 0 # Chai Wah Wu, May 05 2023

A091945 Numbers n such that there is no k, 0 <= k < n, satisfying A002487(k) = A002487(n).

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 19, 21, 33, 35, 37, 39, 43, 45, 69, 73, 75, 77, 83, 85, 93, 139, 141, 147, 149, 151, 153, 155, 165, 171, 173, 189, 267, 275, 277, 279, 283, 293, 297, 299, 301, 309, 315, 325, 331, 333, 339, 341, 365, 537, 549, 553, 555, 563, 565, 567, 579, 585
Offset: 1

Views

Author

Benoit Cloitre, Mar 11 2004

Keywords

Crossrefs

Programs

Extensions

Leading 0 inserted and name adapted by Rémy Sigrist, Dec 07 2022
Previous Showing 21-30 of 384 results. Next