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 10 results.

A292378 a(n) = 1 + A292377(n) - A292375(n).

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 1, 0, -1, 0, 2, 1, 1, 1, 2, 0, 0, -1, 1, 0, -1, 2, 2, 1, -2, 1, 1, 1, 1, 2, 2, 0, 0, 0, 3, -1, 1, 1, 3, 0, 0, -1, 1, 2, 0, 2, 2, 1, -3, -2, 2, 1, 1, 1, 0, 1, -1, 1, 2, 2, 1, 2, 1, 0, -1, 0, 2, 0, 0, 3, 3, -1, 2, 1, 0, 1, 2, 3, 3, 0, -1, 0, 4, -1, 2, 1, 3, 2, 3, 0, 1, 2, 0, 2, 3, 1, 2, -3, 2, -2, 1, 2, 2, 1, 1
Offset: 1

Views

Author

Antti Karttunen, Sep 17 2017

Keywords

Comments

Locate the node which contains n in binary tree A005940 and traverse towards the root (which is 1), counting separately all numbers of the form 4k+1 and of the form 4k+3 that occur on the path (including also starting n itself, if it is of the either form), until 1 is reached, which however, is never included in the count of 4k+1. a(n) is the count of 4k+3 numbers minus the count of 4k+1 numbers that were encountered.

Crossrefs

Programs

  • Mathematica
    a[1, 1] = 1; a[1, 3] = 0; a[n_, k_] := a[n, k] = a[Which[n == 1, 1, EvenQ@ n, n/2, True, Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ n], k] + Boole[Mod[n, 4] == k]; Array[a[#, 3] - a[#, 1] &, 105] (* Michael De Vlieger, Sep 17 2017 *)
  • Scheme
    (define (A292378 n) (+ 1 (- (A292377 n) (A292375 n))))

Formula

a(n) = 1 + (A292377(n) - A292375(n)).
a(A000040(n)) = A038698(n).

A292377 a(1) = 0, and for n > 1, a(n) = a(A252463(n)) + [n == 3 (mod 4)].

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 2, 0, 0, 1, 3, 1, 3, 2, 2, 0, 3, 0, 4, 1, 1, 3, 5, 1, 0, 3, 1, 2, 5, 2, 6, 0, 2, 3, 3, 0, 6, 4, 4, 1, 6, 1, 7, 3, 1, 5, 8, 1, 0, 0, 4, 3, 8, 1, 2, 2, 3, 5, 9, 2, 9, 6, 2, 0, 2, 2, 10, 3, 4, 3, 11, 0, 11, 6, 1, 4, 3, 4, 12, 1, 0, 6, 13, 1, 4, 7, 6, 3, 13, 1, 3, 5, 5, 8, 5, 1, 13, 0, 3, 0, 13, 4, 14, 3, 2
Offset: 1

Views

Author

Antti Karttunen, Sep 17 2017

Keywords

Comments

For numbers > 1, iterate the map x -> A252463(x) which divides even numbers by 2 and shifts every prime in the prime factorization of odd n one index step towards smaller primes. a(n) counts the numbers of the form 4k+3 encountered until 1 has been reached. The count includes also n itself if it is of the form 4k+3 (A004767).
In other words, locate the node which contains n in binary tree A005940 and traverse from that node towards the root, counting all numbers of the form 4k+3 that occur on the path.

Crossrefs

Programs

  • Mathematica
    a[1] = 0; a[n_] := a[n] = a[Which[n == 1, 1, EvenQ@ n, n/2, True, Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ n]] + Boole[Mod[n, 4] == 3]; Array[a, 105]

Formula

a(1) = 0, and for n > 1, a(n) = a(A252463(n)) + floor((n mod 4)/3).
Equivalently, a(2n) = a(n), and for odd numbers n > 1, a(n) = a(A064989(n)) + [n == 3 (mod 4)].
a(n) = A000120(A292383(n)).
Other identities. For n >= 1:
a(n) >= A292376(n).
a(A000040(n)) = A267098(n).
1 + a(n) - A292375(n) = A292378(n).
For n >= 2, a(n) + A292375(n) = A061395(n).

A292381 Base-2 expansion of a(n) encodes the steps where numbers of the form 4k+1 are encountered when map x -> A252463(x) is iterated down to 1, starting from x=n.

Original entry on oeis.org

1, 2, 4, 4, 9, 8, 18, 8, 9, 18, 36, 16, 73, 36, 16, 16, 147, 18, 294, 36, 37, 72, 588, 32, 19, 146, 16, 72, 1177, 32, 2354, 32, 73, 294, 32, 36, 4709, 588, 144, 72, 9419, 74, 18838, 144, 33, 1176, 37676, 64, 39, 38, 292, 292, 75353, 32, 74, 144, 589, 2354, 150706, 64, 301413, 4708, 72, 64, 147, 146, 602826, 588, 1177, 64, 1205652, 72, 2411305, 9418, 36, 1176
Offset: 1

Views

Author

Antti Karttunen, Sep 15 2017

Keywords

Examples

			For n = 1, the starting value (which is also the ending point) is of the form 4k+1, thus a(1) = 1*(2^0) = 1.
For n = 2, the starting value is not of the form 4k+1, but its parent, A252463(2) = 1 is, thus a(2) = 0*(2^0) + 1*(2^1) = 2.
For n = 3, the starting value is not of the form 4k+1, after which follows 2 (also not 4k+1), and then 2 -> 1, and it is only the end-point of iteration which is of the form 4k+1, thus a(3) = 0*(2^0) + 0*(2^1) + 1*(2^2) = 4.
For n = 5, the starting value is of the form 4k+1, after which follows A252463(5) = 3 (which is not), and then continuing as before as 3 -> 2 -> 1, thus a(5) = 1*(2^0) + 0*(2^1) + 0*(2^2) + 1*(2^3) = 9.
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[Reverse@ NestWhileList[Function[k, Which[k == 1, 1, EvenQ@ k, k/2, True, Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ k]], n, # > 1 &] /. k_ /; IntegerQ@ k :> If[Mod[k, 4] == 1, 1, 0], 2], {n, 76}] (* Michael De Vlieger, Sep 21 2017 *)
  • PARI
    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)};
    A252463(n) = if(!(n%2),n/2,A064989(n));
    A292381(n) = if(1==n,n,(if(1==(n%4),1,0)+(2*A292381(A252463(n)))));
    
  • Python
    from sympy.core.cache import cacheit
    from sympy.ntheory.factor_ import digits
    from sympy import factorint, prevprime
    from operator import mul
    from functools import reduce
    def a292371(n):
        k=digits(n, 4)[1:]
        return 0 if n==0 else int("".join(['1' if i==1 else '0' for i in k]), 2)
    def a064989(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==2 else prevprime(i)**f[i] for i in f])
    def a252463(n): return 1 if n==1 else n//2 if n%2==0 else a064989(n)
    @cacheit
    def a292384(n): return 1 if n==1 else 4*a292384(a252463(n)) + n%4
    def a(n): return a292371(a292384(n))
    print([a(n) for n in range(1, 111)]) # Indranil Ghosh, Sep 21 2017
  • Scheme
    (define (A292381 n) (A292371 (A292384 n)))
    

Formula

a(1) = 1; for n > 1, a(n) = 2*a(A252463(n)) + [n ≡ 1 (mod 4)], where the last part of the formula is Iverson bracket, giving 1 only if n is of the form 4k+1, and 0 otherwise.
a(n) = A292371(A292384(n)).
Other identities. For n >= 1:
a(2n) = 2*a(n).
A000120(a(n)) = A292375(n).
For n >= 2, a(n) = A004754(A292385(n)).

A332897 a(1) = 0, a(2) = 1, and for n > 2, a(n) = a(A332893(n)) + [n == 1 (mod 4)].

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 2, 1, 2, 2, 3, 1, 3, 2, 1, 1, 4, 2, 4, 2, 3, 3, 5, 1, 3, 3, 1, 2, 5, 1, 6, 1, 4, 4, 1, 2, 6, 4, 2, 2, 7, 3, 7, 3, 2, 5, 8, 1, 4, 3, 3, 3, 8, 1, 2, 2, 5, 5, 9, 1, 9, 6, 2, 1, 4, 4, 10, 4, 6, 1, 11, 2, 10, 6, 2, 4, 5, 2, 12, 2, 2, 7, 13, 3, 5, 7, 4, 3, 11, 2, 1, 5, 7, 8, 3, 1, 12, 4, 3, 3, 13, 3, 14, 3, 2
Offset: 1

Views

Author

Antti Karttunen, Mar 04 2020

Keywords

Comments

Starting from x=n, iterate the map x -> A332893(x) which divides even numbers by 2, and for odd n changes every 4k+1 prime in their prime factorization to 4k+3 prime and vice versa (except 3 -> 2), like in A332819. a(n) counts the numbers of the form 4k+1 encountered until 1 has been reached, which is also included in the count when n > 1. This count includes also n itself when it is of the form 4k+1 (A016813) and larger than 1.

Crossrefs

Programs

Formula

a(1) = 0, a(2) = 1, and for n > 2, a(n) = a(A332893(n)) + [n == 1 (mod 4)].
a(n) = A000120(A332895(n)).

A292584 Compound filter: a(n) = P(A292583(n), A292585(n)), where P(n,k) is sequence A000027 used as a pairing function.

Original entry on oeis.org

1, 2, 5, 2, 8, 5, 13, 2, 4, 8, 19, 5, 25, 13, 9, 2, 32, 4, 41, 8, 12, 19, 51, 5, 16, 25, 5, 13, 72, 9, 85, 2, 18, 32, 14, 4, 98, 41, 26, 8, 112, 12, 128, 19, 8, 51, 145, 5, 46, 16, 33, 25, 180, 5, 18, 13, 49, 72, 200, 9, 220, 85, 13, 2, 24, 18, 242, 32, 60, 14, 265, 4, 288, 98, 8, 41, 19, 26, 313, 8, 4, 112, 339, 12, 33, 128, 62, 19, 365, 8, 25, 51, 84, 145
Offset: 1

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

From Antti Karttunen, Sep 25 2017: (Start)
Some of the sequences this filter matches to:
For all i, j: a(i) = a(j) => A053866(i) = A053866(j).
For all i, j: a(i) = a(j) => A061395(i) = A061395(j). (also A006530, etc.)
For all i, j: a(i) = a(j) => A292378(i) = A292378(j).
The latter two implications follow simply because:
and, similarly, for n > 1,
and the sum of A292375(n) and A292377(n) is A061395(n) [index of the largest prime dividing n], while A292378 has been defined as 1 + their difference.
The case A053866 follows because of the component A292583, see comments under that entry. (End)

Crossrefs

Cf. also A006530, A061395, A292378 (some of the matched sequences).

Formula

a(n) = (1/2)*(2 + ((A292583(n)+A292585(n))^2) - A292583(n) - 3*A292585(n)).

A292585 Restricted growth sequence transform of A278222(A292385(n)).

Original entry on oeis.org

1, 2, 2, 2, 3, 2, 3, 2, 3, 3, 3, 2, 4, 3, 2, 2, 5, 3, 5, 3, 4, 3, 5, 2, 6, 4, 2, 3, 7, 2, 7, 2, 4, 5, 2, 3, 8, 5, 3, 3, 9, 4, 9, 3, 3, 5, 9, 2, 10, 6, 4, 4, 11, 2, 4, 3, 7, 7, 11, 2, 12, 7, 3, 2, 5, 4, 12, 5, 7, 2, 12, 3, 13, 8, 3, 5, 3, 3, 13, 3, 3, 9, 13, 4, 4, 9, 5, 3, 14, 3, 4, 5, 8, 9, 4, 2, 15, 10, 3, 6, 16, 4, 16, 4, 3
Offset: 1

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

Term a(n) essentially records the run lengths of numbers of form 4k+1 encountered when starting from that node in binary tree A005940 which contains n, and by then traversing towards the root by iterating the map n -> A252463(n). The actual run lengths can be read from the exponents of primes in the prime factorization of A278222(A292385(m)), where m = min_{k=1..n} for which a(k) = a(n). In compound filter A292584 this is combined with similar information about the run lengths of the numbers of the form 4k+3 (A292583).

Examples

			When traversing from the root of binary tree A005940 from the node which contains 5, one obtains path 5 -> 3 -> 2 -> 1. Of these numbers, 5 and 1 are of the form 4k+1, while others are not, thus there are two separate runs of length 1: [1, 1]. On the other hand, when traversing from 9 as 9 -> 4 -> 2 -> 1, again only two terms are of the form 4k+1: 9 and 1 and they are not next to each other, so we have the same two runs of one each: [1, 1]. Similarly for n = 7, and n = 10 as neither in path 7 -> 5 -> 3 -> 2 -> 1 nor in path 10 -> 5 -> 3 -> 2 -> 1 are any more 4k+1 terms (compared to the path beginning from 5). Thus a(5), a(7), a(9) and a(10) are all allotted the same value by the restricted growth sequence transform, which in this case is 3.  Note that 3 occurs in this sequence for the first time at n=5, with A292385(5) = 5 and A278222(5) = 6 = 2^1 * 3^1, where those run lengths 1 and 1 are the prime exponents of 6.
		

Crossrefs

Programs

  • PARI
    allocatemem(2^30);
    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; };
    write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ Modified from code of M. F. Hasler
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ This function from Charles R Greathouse IV, Aug 17 2011
    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)};
    A278222(n) = A046523(A005940(1+n));
    A252463(n) = if(!(n%2),n/2,A064989(n));
    A292385(n) = if(n<=2,n-1,(if(1==(n%4),1,0)+(2*A292385(A252463(n)))));
    write_to_bfile(1,rgs_transform(vector(16384,n,A278222(A292385(n)))),"b292585_upto16384.txt");

A336123 a(1) = 0, a(2) = 1, and for n > 2, a(n) = [A122111(n) == 1 (mod 4)] + a(A253553(n)).

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 3, 2, 1, 1, 1, 2, 2, 1, 1, 3, 1, 1, 2, 2, 1, 1, 1, 2, 3, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1, 3, 1, 1, 3, 3, 1, 1, 1, 2, 2, 2, 1, 3, 1, 1, 2, 2, 2, 1, 1, 2, 4, 1, 1, 3, 1, 1, 2, 2, 1, 1, 2, 2, 2, 1, 1, 3, 1, 1, 3, 2, 1, 1, 1, 2, 2
Offset: 1

Views

Author

Antti Karttunen, Jul 17 2020

Keywords

Crossrefs

Programs

  • PARI
    \\ Uses also code given in A336124:
    A253553(n) = if(n<=2,1,my(f=factor(n), k=#f~); if(f[k,2]>1,f[k,2]--,f[k,1] = precprime(f[k,1]-1)); factorback(f));
    A336123(n) = if(n<=2,n-1,(1==A336124(n))+A336123(A253553(n)));

Formula

a(1) = 0, a(2) = 1, and for n > 2, a(n) = [A336124(n) == 1] + a(A253553(n)).
a(n) = A000120(A336125(n)).
For n > 1, a(n) = A292375(A122111(n)).
a(n) = A001222(n) - A336121(n).
For all n >= 0, a(3^n) = n.

A292374 a(1) = 1, a(2n) = 0, and for odd numbers n > 1, a(n) = a(A064989(n)) + [n == 1 (mod 4)].

Original entry on oeis.org

1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 0, 0, 3, 0, 3, 0, 1, 0, 3, 0, 2, 0, 0, 0, 4, 0, 4, 0, 1, 0, 0, 0, 5, 0, 0, 0, 6, 0, 6, 0, 1, 0, 6, 0, 3, 0, 0, 0, 7, 0, 1, 0, 1, 0, 7, 0, 8, 0, 0, 0, 2, 0, 8, 0, 1, 0, 8, 0, 9, 0, 0, 0, 1, 0, 9, 0, 1, 0, 9, 0, 1, 0, 0, 0, 10, 0, 1, 0, 1, 0, 0, 0, 11, 0, 0, 0, 12, 0, 12, 0, 1
Offset: 1

Views

Author

Antti Karttunen, Sep 17 2017

Keywords

Comments

For odd numbers > 1, iterate the map x -> A064989(x), which shifts every prime in the prime factorization of n one index step towards smaller primes. a(n) counts the numbers of the form 4k+1 encountered until the first number which is even has been reached. This count includes also n itself if it is of the form 4k+1 (A016813), thus a(1) = 1.
In other words, locate the position where n is in square array A246278 and moving up by that column, count all numbers of the form 4k+1 until an even number at the top of the column is reached.

Crossrefs

Cf. also A038802 (odd bisection of a(n) + A292376(n)).

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = If[EvenQ@ n, 0, a[Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ n] + Boole[Mod[n, 4] == 1]]; Array[a, 105] (* Michael De Vlieger, Sep 17 2017 *)
  • PARI
    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)};
    A292374(n) = if(1==n,n,if(!(n%2),0,(if(1==(n%4),1,0)+A292374(A064989(n)))));
    
  • Scheme
    ;; With memoization-macro definec.
    (definec (A292374 n) (cond ((even? n) 0) ((= 1 n) 1) (else (+ (if (= 1 (modulo n 4)) 1 0) (A292374 (A064989 n))))))

Formula

a(1) = 1, a(2n) = 0, and for odd numbers n > 1, a(n) = a(A064989(n)) + [n == 1 (mod 4)].
a(n) <= A292375(n).
For n >= 2, a(n) + A292376(n) + 1 = A055396(n).

A292603 Doudna-tree reduced modulo 4: a(n) = A005940(1+n) mod 4.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 01 2017

Keywords

Examples

			The first six levels of the binary tree (compare also to the illustrations given at A005940 and A292602):
                               1
                               |
                               2
                ............../ \..............
               3                               0
        ....../ \......                 ....../ \......
       1               2               1               0
      / \             / \             / \             / \
     /   \           /   \           /   \           /   \
    3     2         3     0         1     2         3     0
   / \   / \       / \   / \       / \   / \       / \   / \
  3   2 1   0     3   2 1   0     1   2 3   0     1   2 1   0
		

Crossrefs

Cf. A004767 (gives the positions of 0's), A016813 (of 2's).

Programs

Formula

a(n) = A010873(A005940(1+n)).
a(n) + 4*A292602(n) = A005940(1+n).
a(2n+1) = 2*a(n) mod 4.
a(A004767(n)) = 0.
a(A016813(n)) = 2.
a(2*A156552(A246261(n))) = 1.
a(2*A156552(A246263(n))) = 3.
a(n * 2^(1+A246271(A005940(1+n)))) = 1.

A353484 a(1) = 0; and for n > 1, a(n) = A165560(n) + a(A064989(n)), where A165560 is the parity of arithmetic derivative, and A064989 shifts the prime factorization of its argument one step toward lower primes.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 22 2022

Keywords

Comments

a(n) counts the number of the terms of A235991 encountered [including also n itself if the arithmetic derivative of n is odd] when repeatedly prime shifting n down to 1.

Crossrefs

Cf. A003415, A064989, A165560, A235991, A353485 (positions of zeros).

Programs

  • PARI
    A000265(n) = (n>>valuation(n,2));
    A003415(n) = if(n<=1, 0, my(f=factor(n)); n*sum(i=1, #f~, f[i, 2]/f[i, 1]));
    A064989(n) = { my(f=factor(A000265(n))); for(i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f); };
    A353484(n) = if(1==n, 0, (A003415(n)%2) + A353484(A064989(n)));

Formula

For n >= 1, a(A000040(n)) = n, a(n^2) = 0.
Showing 1-10 of 10 results.