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

A263273 Bijective base-3 reverse: a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Comments

Here the base-3 reverse has been adjusted so that the maximal suffix of trailing zeros (in base-3 representation A007089) stays where it is at the right side, and only the section from the most significant digit to the least significant nonzero digit is reversed, thus making this sequence a self-inverse permutation of nonnegative integers.
Because successive powers of 3 and 9 modulo 2, 4 and 8 are always either constant 1, 1, 1, ... or alternating 1, -1, 1, -1, ... it implies similar simple divisibility rules for 2, 4 and 8 in base 3 as e.g. 3, 9 and 11 have in decimal base (see the Wikipedia-link). As these rules do not depend on which direction they are applied from, it means that this bijection preserves the fact whether a number is divisible by 2, 4 or 8, or whether it is not. Thus natural numbers are divided to several subsets, each of which is closed with respect to this bijection. See the Crossrefs section for permutations obtained from these sections.
When polynomials over GF(3) are encoded as natural numbers (coefficients presented with the digits of the base-3 expansion of n), this bijection works as a multiplicative automorphism of the ring GF(3)[X]. This follows from the fact that as there are no carries involved, the multiplication (and thus also the division) of such polynomials could be as well performed by temporarily reversing all factors (like they were seen through mirror). This implies also that the sequences A207669 and A207670 are closed with respect to this bijection.

Examples

			For n = 15, A007089(15) = 120. Reversing this so that the trailing zero stays at the right yields 210 = A007089(21), thus a(15) = 21 and vice versa, a(21) = 15.
		

Crossrefs

Bisections: A264983, A264984.
Permutations induced by various sections: A263272 (a(2n)/2), A264974 (a(4n)/4), A264978 (a(8n)/8), A264985, A264989.
Cf. also A004488, A140263, A140264, A246207, A246208 (other base-3 related permutations).

Programs

  • Mathematica
    r[n_] := FromDigits[Reverse[IntegerDigits[n, 3]], 3]; b[n_] := n/ 3^IntegerExponent[n, 3]; c[n_] := n/b[n]; a[0]=0; a[n_] := r[b[n]]*c[n]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Dec 29 2015 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a(n): return 0 if n==0 else a030102(a038502(n))*a038500(n) # Indranil Ghosh, May 22 2017
  • Scheme
    (define (A263273 n) (if (zero? n) n (* (A030102 (A038502 n)) (A038500 n))))
    

Formula

a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
A010873(a(n)) = 0 if and only if A010873(n) = 0. [See the comments section.]

A348930 a(n) = A038502(sigma(n)), where A038502 is fully multiplicative with a(3) = 1, and a(p) = p for any other prime p.

Original entry on oeis.org

1, 1, 4, 7, 2, 4, 8, 5, 13, 2, 4, 28, 14, 8, 8, 31, 2, 13, 20, 14, 32, 4, 8, 20, 31, 14, 40, 56, 10, 8, 32, 7, 16, 2, 16, 91, 38, 20, 56, 10, 14, 32, 44, 28, 26, 8, 16, 124, 19, 31, 8, 98, 2, 40, 8, 40, 80, 10, 20, 56, 62, 32, 104, 127, 28, 16, 68, 14, 32, 16, 8, 65, 74, 38, 124, 140, 32, 56, 80, 62, 121, 14, 28
Offset: 1

Views

Author

Antti Karttunen, Nov 04 2021

Keywords

Comments

Note that a(A005820(4)) = A005820(4) and a(A005820(6)) = A005820(6), i.e., the fourth and sixth 3-perfect numbers, 459818240 and 51001180160 are among the fixed points of this sequence, precisely because they are also terms of A323653. As the former factorizes as 459818240 = 256 * 5 * 7 * 19 * 37 * 73, it must follow that a(256)/256 * a(5)/5 * a(7)/7 * a(19)/19 * a(37)/37 * a(73)/73 = 1, because ratio a(n)/n is multiplicative. See also comments in A348738.

Crossrefs

Programs

  • Mathematica
    s[n_] := n / 3^IntegerExponent[n, 3]; Table[s[DivisorSigma[1, n]], {n, 1, 100}] (* Amiram Eldar, Nov 04 2021 *)
  • PARI
    A038502(n) = (n/3^valuation(n, 3));
    A348930(n) = A038502(sigma(n));

Formula

Multiplicative with a(p^e) = A038502(1 + p + p^2 + ... + p^e).
a(n) = A038502(A000203(n)).
For all n >= 1, A000265(a(n)) = A336457(n).

A179787 Let the operation <+> be defined by x<+>y = A038502(x+y). a(n) is the period in the track of the iterated application x<+>(x<+>...(x<+>1)) for x = A001651(n-1).

Original entry on oeis.org

2, 1, 2, 4, 6, 1, 4, 4, 2, 6, 3, 16, 18, 2, 3, 8, 20, 1, 6, 28, 30, 7, 16, 10, 18, 18, 2, 8, 42, 8, 11, 18, 42, 20, 4, 52, 20, 3, 28, 26, 10, 30, 15, 10, 22, 12, 8, 28, 12, 18, 18, 28, 78, 1, 8, 38, 14, 42, 9, 88, 4, 22, 23, 28, 48, 42, 18, 100, 34, 3, 52, 50, 22, 20, 9, 112, 38, 22, 23, 38
Offset: 1

Views

Author

Vladimir Shevelev, Jul 27 2010

Keywords

Comments

The symbol <+> removes powers of three of the sum of the two operands.
The process of starting with 1, adding some constant number x = A001651(n-1) and reducing it iteratively with this operation defines a track 1, x<+>1, x<+>(x<+>1), ... which enters a cycle.
The period of this cycle specifies a(n).
Similar iterated reductions can be defined for power bases m other than 3.

Examples

			For n=5 we take x=A001651(4)=7. The iteration yields 1, 7<+>1=8, 7<+>8=5, 7<+>5=4, 7<+>4=11, 7<+>11=2, 7<+>2=1.
We have reached the 1 of the beginning and therefore a cycle of length a(5)=6.
		

Crossrefs

Programs

  • Maple
    A038502 := proc(n) a := 1; for p in ifactors(n)[2] do if op(1,p) <> 3 then a := a*op(1,p)^op(2,p) ; end if; end do; a ; end proc:
    A179787aux := proc(x,y) local xtrack,xitr,xpos ; xtrack := [y] ; while true do xitr := A038502(op(-1,xtrack)+x) ;
    if not member(xitr, xtrack,'xpos') then xtrack := [op(xtrack),xitr] ; else return 1+nops(xtrack)-xpos ; end if; end do: end proc:
    A001651 := proc(n) option remember; if n <=2 then n; else procname(n-2)+3 ; end if; end proc:
    A179787 := proc(n) A179787aux(A001651(n),1) ; end proc: seq(A179787(n),n=1..80) ; # R. J. Mathar, Nov 04 2010

Extensions

a(22) corrected, definition tightened removing new terminology, sequence extended beyond a(55) by R. J. Mathar, Nov 04 2010

A332018 a(n) = A038502(A000265(n)) if n is even or n == 0 (mod 3), a(n) = A038502(A000265(5*n + 1)) otherwise.

Original entry on oeis.org

1, 1, 1, 1, 13, 1, 1, 1, 1, 5, 7, 1, 11, 7, 5, 1, 43, 1, 1, 5, 7, 11, 29, 1, 7, 13, 1, 7, 73, 5, 13, 1, 11, 17, 11, 1, 31, 19, 13, 5, 103, 7, 1, 11, 5, 23, 59, 1, 41, 25, 17, 13, 133, 1, 23, 7, 19, 29, 37, 5, 17, 31, 7, 1, 163, 11, 7, 17, 23, 35, 89, 1, 61, 37
Offset: 1

Views

Author

Davis Smith, Feb 04 2020

Keywords

Comments

a(n) is the greatest divisor of n coprime to 6 if n is not coprime to 6, otherwise a(n) is the greatest divisor of 5*n + 1 coprime to 6.
This is the '5x+1' map with the successive dividing steps removed. The 'Px+1' map with those steps removed: If x is divisible by any prime < P, then divide out those primes; otherwise multiply x by P, add 1, and then divide out the primes < P.
There is a conjecture which states that for any value of n > 0 there is a k such that a^{k}(n) = 1 or a^{k}(n) enters one of a finite number of periodic cycles, where a^{0}(n) = n and a^{k + 1}(n) = a(a^{k}(n)).

Crossrefs

Programs

  • Magma
    [Gcd(n,6) ne 1 select n/(Gcd(n, 2^n)*Gcd(n, 3^n)) else (5*n + 1)/(Gcd(5*n + 1, 2^(5*n + 1))*Gcd(5*n + 1, 3^(5*n + 1))):n in [1..75]]; // Marius A. Burtea, Feb 06 2020
  • Maple
    A332018 := proc(n) option remember;
    if n mod 2 = 0 or n mod 3 = 0 then n/(2^padic[ordp](n, 2)*3^padic[ordp](n, 3))
    else (5*n+1)/(2^padic[ordp](5*n+1, 2)*3^padic[ordp](5*n+1, 3)) fi end:
    seq(A332018(n), n=1..80);
  • Mathematica
    b[n_]:=Denominator[2^n/n]; c[n_]:=Denominator[3^n/n]; Table[If[EvenQ[n]||(Mod[n, 3] == 0), c[b[n]], c[b[5*n + 1]]], {n, 1, 80}]
  • PARI
    A332018(n)=my(val(x)=x/(2^valuation(x,2)*3^valuation(x,3))); val(if(n%2&&n%3,5*n+1,n))
    

Formula

a(n) = A038502(A000265(A133419(n))).
a(n) = n/(gcd(n, 2^n)*gcd(n, 3^n)) if n is not coprime to 6, a(n) = (5*n + 1)/(gcd(5*n + 1, 2^(5*n + 1))*gcd(5*n + 1, 3^(5*n + 1))) otherwise.

A370526 Square array read by descending antidiagonals: Define function b(i,n,k) where b(0,n,k) = n, b(1,n,k) = k, b(i,n,k) = A038502(b(i-1,n,k) + b(i-2,n,k)). T(n,k) is the number of steps until reaching the cyclic part of {b(i,n,k)}, or -1 if no cycle exists.

Original entry on oeis.org

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

Views

Author

Yifan Xie, Feb 21 2024

Keywords

Comments

b(i,n,k) = (b(i-1,n,k) + b(i-2,n,k))/p^valuation(b(i-1,n,k) + b(i-2,n,k), p), i.e., b(i,n,k) is b(i-1,n,k) + b(i-2,n,k) with all factors of p removed, where p = 3 in this sequence. Therefore, b(i,n,k) is not divisible by 3 for i >= 3.
At least one of b(i,n,k) < b(i-1,n,k) + b(i-2,n,k) and b(i+1,n,k) < b(i-1,n,k) + b(i,n,k) is true for i >= 5.
It appears that all repetends have the form of (1, 1, 2) (the position of 2 possibly changed), multiplied by G = A038502(gcd(n,k)).
Conjecture: T(n,k) >= 0.
This conjecture can be supported by a heuristic argument: Using dynamic programming, we can compute that for p's in A000057, the probability that b(i-1,n,k) + b(i-2,n,k) is not divisible by p is (p-2)/p, and the probability that valuation(b(i-1,n,k) + b(i-2,n,k), p) = x (x >= 1) is 2*(p-1)/p^(x+1). Therefore, the mathematical expectation of a(i) is (a(i-1,n,k) + a(i-2,n,k))*(p-1)/(p+1), which is exactly the average of the earlier two terms when p = 3, and larger when p >= 5.

Examples

			Array begins:
  n\k|  1   2   3   4   5   6   7
  ---+--------------------------------
  1  |  0,  0, 12,  3,  6, 11, 17, ...
  2  |  0,  0, 24,  0, 12, 12,  4, ...
  3  |  4, 13, 14, 11, 23, 19,  4, ...
  4  |  7,  0,  5,  0,  2, 24, 10, ...
  5  |  1,  5, 15,  8,  0, 27, 11, ...
  6  | 18,  4,  5, 13, 23, 14, 10, ...
  7  |  3,  1, 12, 10,  9,  7, 29, ...
  ...
T(1,4) = 3 because its sequence b begins with b(0) = 1, b(1) = 4, b(2) = A038502(1+4) = 5, b(3) = A038502(4+5) = 1, b(4) = 2, b(5) = 1, b(6) = 1, which has reached the cyclic part of (1, 2, 1) at i=3.
		

Crossrefs

Programs

  • PARI
    T(n, k)={my(i=-1, z=0); while((z != 2*n || z != 2*k) && (n != 2*z || n != 2*k) && (k != 2*n || k != 2*z), z=n; n=k; k=(z+n)/3^(valuation(z+n, 3)); i++); i; };

Formula

T(n,k) = 0 iff n = k, n = 2*k or k = 2*n and gcd(x,y) is not divisible by 3.

A000265 Remove all factors of 2 from n; or largest odd divisor of n; or odd part of n.

Original entry on oeis.org

1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, 3, 13, 7, 15, 1, 17, 9, 19, 5, 21, 11, 23, 3, 25, 13, 27, 7, 29, 15, 31, 1, 33, 17, 35, 9, 37, 19, 39, 5, 41, 21, 43, 11, 45, 23, 47, 3, 49, 25, 51, 13, 53, 27, 55, 7, 57, 29, 59, 15, 61, 31, 63, 1, 65, 33, 67, 17, 69, 35, 71, 9, 73, 37, 75, 19, 77
Offset: 1

Views

Author

Keywords

Comments

When n > 0 is written as k*2^j with k odd then k = A000265(n) and j = A007814(n), so: when n is written as k*2^j - 1 with k odd then k = A000265(n+1) and j = A007814(n+1), when n > 1 is written as k*2^j + 1 with k odd then k = A000265(n-1) and j = A007814(n-1).
Also denominator of 2^n/n (numerator is A075101(n)). - Reinhard Zumkeller, Sep 01 2002
Slope of line connecting (o, a(o)) where o = (2^k)(n-1) + 1 is 2^k and (by design) starts at (1, 1). - Josh Locker (joshlocker(AT)macfora.com), Apr 17 2004
Numerator of n/2^(n-1). - Alexander Adamchuk, Feb 11 2005
From Marco Matosic, Jun 29 2005: (Start)
"The sequence can be arranged in a table:
1
1 3 1
1 5 3 7 1
1 9 5 11 3 13 7 15 1
1 17 9 19 5 21 11 23 3 25 13 27 7 29 15 31 1
Every new row is the previous row interspaced with the continuation of the odd numbers.
Except for the ones; the terms (t) in each column are t+t+/-s = t_+1. Starting from the center column of threes and working to the left the values of s are given by A000265 and working to the right by A000265." (End)
This is a fractal sequence. The odd-numbered elements give the odd natural numbers. If these elements are removed, the original sequence is recovered. - Kerry Mitchell, Dec 07 2005
2k + 1 is the k-th and largest of the subsequence of k terms separating two successive equal entries in a(n). - Lekraj Beedassy, Dec 30 2005
It's not difficult to show that the sum of the first 2^n terms is (4^n + 2)/3. - Nick Hobson, Jan 14 2005
In the table, for each row, (sum of terms between 3 and 1) - (sum of terms between 1 and 3) = A020988. - Eric Desbiaux, May 27 2009
This sequence appears in the analysis of A160469 and A156769, which resemble the numerator and denominator of the Taylor series for tan(x). - Johannes W. Meijer, May 24 2009
Indices n such that a(n) divides 2^n - 1 are listed in A068563. - Max Alekseyev, Aug 25 2013
From Alexander R. Povolotsky, Dec 17 2014: (Start)
With regard to the tabular presentation described in the comment by Marco Matosic: in his drawing, starting with the 3rd row, the first term in the row, which is equal to 1 (or, alternatively the last term in the row, which is also equal to 1), is not in the actual sequence and is added to the drawing as a fictitious term (for the sake of symmetry); an actual A000265(n) could be considered to be a(j,k) (where j >= 1 is the row number and k>=1 is the column subscript), such that a(j,1) = 1:
1
1 3
1 5 3 7
1 9 5 11 3 13 7 15
1 17 9 19 5 21 11 23 3 25 13 27 7 29 15 31
and so on ... .
The relationship between k and j for each row is 1 <= k <= 2^(j-1). In this corrected tabular representation, Marco's notion that "every new row is the previous row interspaced with the continuation of the odd numbers" remains true. (End)
Partitions natural numbers to the same equivalence classes as A064989. That is, for all i, j: a(i) = a(j) <=> A064989(i) = A064989(j). There are dozens of other such sequences (like A003602) for which this also holds: In general, all sequences for which a(2n) = a(n) and the odd bisection is injective. - Antti Karttunen, Apr 15 2017
From Paul Curtz, Feb 19 2019: (Start)
This sequence is the truncated triangle:
1, 1;
3, 1, 5;
3, 7, 1, 9;
5, 11, 3, 13, 7;
15, 1, 17, 9, 19, 5;
21, 11, 23, 3, 25, 13, 27;
7, 29, 15, 31, 1, 33, 17, 35;
...
The first column is A069834. The second column is A213671. The main diagonal is A236999. The first upper diagonal is A125650 without 0.
c(n) = ((n*(n+1)/2))/A069834 = 1, 1, 2, 2, 1, 1, 4, 4, 1, 1, 2, 2, 1, 1, 8, 8, 1, 1, ... for n > 0. n*(n+1)/2 is the rank of A069834. (End)
As well as being multiplicative, a(n) is a strong divisibility sequence, that is, gcd(a(n),a(m)) = a(gcd(n,m)) for n, m >= 1. In particular, a(n) is a divisibility sequence: if n divides m then a(n) divides a(m). - Peter Bala, Feb 27 2019
a(n) is also the map n -> A026741(n) applied at least A007814(n) times. - Federico Provvedi, Dec 14 2021

Examples

			G.f. = x + x^2 + 3*x^3 + x^4 + 5*x^5 + 3*x^6 + 7*x^7 + x^8 + 9*x^9 + 5*x^10 + 11*x^11 + ...
		

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A049606 (partial products), A135013 (partial sums), A099545 (mod 4), A326937 (Dirichlet inverse).
Cf. A026741 (map), A001511 (converging steps), A038550 (prime index).
Cf. A195056 (Dgf at s=3).

Programs

  • Haskell
    a000265 = until odd (`div` 2)
    -- Reinhard Zumkeller, Jan 08 2013, Apr 08 2011, Oct 14 2010
    
  • Java
    int A000265(n){
        while(n%2==0) n>>=1;
        return n;
    }
    /* Aidan Simmons, Feb 24 2019 */
    
  • Julia
    using IntegerSequences
    [OddPart(n) for n in 1:77] |> println  # Peter Luschny, Sep 25 2021
    
  • Magma
    A000265:= func< n | n/2^Valuation(n,2) >;
    [A000265(n): n in [1..120]]; // G. C. Greubel, Jul 31 2024
    
  • Maple
    A000265:=proc(n) local t1,d; t1:=1; for d from 1 by 2 to n do if n mod d = 0 then t1:=d; fi; od; t1; end: seq(A000265(n), n=1..77);
    A000265 := n -> n/2^padic[ordp](n,2): seq(A000265(n), n=1..77); # Peter Luschny, Nov 26 2010
  • Mathematica
    a[n_Integer /; n > 0] := n/2^IntegerExponent[n, 2]; Array[a, 77] (* Josh Locker *)
    a[ n_] := If[ n == 0, 0, n / 2^IntegerExponent[ n, 2]]; (* Michael Somos, Dec 17 2014 *)
  • PARI
    {a(n) = n >> valuation(n, 2)}; /* Michael Somos, Aug 09 2006, edited by M. F. Hasler, Dec 18 2014 */
    
  • Python
    from _future_ import division
    def A000265(n):
        while not n % 2:
            n //= 2
        return n # Chai Wah Wu, Mar 25 2018
    
  • Python
    def a(n):
        while not n&1: n >>= 1
        return n
    print([a(n) for n in range(1, 78)]) # Michael S. Branicky, Jun 26 2025
    
  • SageMath
    def A000265(n): return n//2^valuation(n,2)
    [A000265(n) for n in (1..121)] # G. C. Greubel, Jul 31 2024
  • Scheme
    (define (A000265 n) (let loop ((n n)) (if (odd? n) n (loop (/ n 2))))) ;; Antti Karttunen, Apr 15 2017
    

Formula

a(n) = if n is odd then n, otherwise a(n/2). - Reinhard Zumkeller, Sep 01 2002
a(n) = n/A006519(n) = 2*A025480(n-1) + 1.
Multiplicative with a(p^e) = 1 if p = 2, p^e if p > 2. - David W. Wilson, Aug 01 2001
a(n) = Sum_{d divides n and d is odd} phi(d). - Vladeta Jovovic, Dec 04 2002
G.f.: -x/(1 - x) + Sum_{k>=0} (2*x^(2^k)/(1 - 2*x^(2^(k+1)) + x^(2^(k+2)))). - Ralf Stephan, Sep 05 2003
(a(k), a(2k), a(3k), ...) = a(k)*(a(1), a(2), a(3), ...) In general, a(n*m) = a(n)*a(m). - Josh Locker (jlocker(AT)mail.rochester.edu), Oct 04 2005
a(n) = Sum_{k=0..n} A127793(n,k)*floor((k+2)/2) (conjecture). - Paul Barry, Jan 29 2007
Dirichlet g.f.: zeta(s-1)*(2^s - 2)/(2^s - 1). - Ralf Stephan, Jun 18 2007
a(A132739(n)) = A132739(a(n)) = A132740(n). - Reinhard Zumkeller, Aug 27 2007
a(n) = 2*A003602(n) - 1. - Franklin T. Adams-Watters, Jul 02 2009
a(n) = n/gcd(2^n,n). (This also shows that the true offset is 0 and a(0) = 0.) - Peter Luschny, Nov 14 2009
a(-n) = -a(n) for all n in Z. - Michael Somos, Sep 19 2011
From Reinhard Zumkeller, May 01 2012: (Start)
A182469(n, k) = A027750(a(n), k), k = 1..A001227(n).
a(n) = A182469(n, A001227(n)). (End)
a((2*n-1)*2^p) = 2*n - 1, p >= 0 and n >= 1. - Johannes W. Meijer, Feb 05 2013
G.f.: G(0)/(1 - 2*x^2 + x^4) - 1/(1 - x), where G(k) = 1 + 1/(1 - x^(2^k)*(1 - 2*x^(2^(k+1)) + x^(2^(k+2)))/(x^(2^k)*(1 - 2*x^(2^(k+1)) + x^(2^(k+2))) + (1 - 2*x^(2^(k+2)) + x^(2^(k+3)))/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Aug 06 2013
a(n) = A003961(A064989(n)). - Antti Karttunen, Apr 15 2017
Completely multiplicative with a(2) = 1 and a(p) = p for prime p > 2, i.e., the sequence b(n) = a(n) * A008683(n) for n > 0 is the Dirichlet inverse of a(n). - Werner Schulte, Jul 08 2018
From Peter Bala, Feb 27 2019: (Start)
O.g.f.: F(x) - F(x^2) - F(x^4) - F(x^8) - ..., where F(x) = x/(1 - x)^2 is the generating function for the positive integers.
O.g.f. for reciprocals: Sum_{n >= 1} x^n/a(n) = L(x) + (1/2)*L(x^2) + (1/2)*L(x^4) + (1/2)*L(x^8) + ..., where L(x) = log(1/(1 - x)).
Sum_{n >= 1} x^n/a(n) = 1/2*log(G(x)), where G(x) = 1 + 2*x + 4*x^2 + 6*x^3 + 10*x^4 + ... is the o.g.f. of A000123. (End)
O.g.f.: Sum_{n >= 1} phi(2*n-1)*x^(2*n-1)/(1 - x^(2*n-1)), where phi(n) is the Euler totient function A000010. - Peter Bala, Mar 22 2019
a(n) = A049606(n) / A049606(n-1). - Flávio V. Fernandes, Dec 08 2020
a(n) = numerator of n/2^(floor(n/2)). - Federico Provvedi, Dec 14 2021
a(n) = Sum_{d divides n} (-1)^(d+1)*phi(2*n/d). - Peter Bala, Jan 14 2024
a(n) = A030101(A030101(n)). - Darío Clavijo, Sep 19 2024

Extensions

Additional comments from Henry Bottomley, Mar 02 2000
More terms from Larry Reeves (larryr(AT)acm.org), Mar 14 2000
Name clarified by David A. Corneth, Apr 15 2017

A038500 Highest power of 3 dividing n.

Original entry on oeis.org

1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 1, 3, 1, 1, 3, 1, 1, 27, 1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 1, 3, 1, 1, 3, 1, 1, 27, 1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 1, 3, 1, 1, 3, 1, 1, 81
Offset: 1

Views

Author

Keywords

Comments

To construct the sequence: start with 1 and concatenate twice: 1,1,1 then tripling the last term gives: 1,1,3. Concatenating those 3 terms twice gives: 1,1,3,1,1,3,1,1,3, triple the last term -> 1,1,3,1,1,3,1,1,9. Concatenating those 9 terms twice gives: 1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9, triple the last term -> 1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,27 etc. - Benoit Cloitre, Dec 17 2002
Also 3-adic value of 1/n, n >= 1. See the Mahler reference, definition on p. 7. This is a non-archimedean valuation. See Mahler, p. 10. Sometimes also called 3-adic absolute value. - Wolfdieter Lang, Jun 28 2014

References

  • Kurt Mahler, p-adic numbers and their functions, second ed., Cambridge University Press, 1981.

Crossrefs

Programs

  • Haskell
    a038500 = f 1 where
       f y x = if m == 0 then f (y * 3) x' else y  where (x', m) = divMod x 3
    -- Reinhard Zumkeller, Jul 06 2014
    
  • Magma
    [3^Valuation(n,3): n in [1..100]]; // Vincenzo Librandi, Dec 29 2015
  • Maple
    A038500 := n -> 3^padic[ordp](n,3): # Peter Luschny, Nov 26 2010
  • Mathematica
    Flatten[{1,1,#}&/@(3^IntegerExponent[#,3]&/@(3*Range[40]))] (* or *) hp3[n_]:=If[Divisible[n,3],3^IntegerExponent[n,3],1]; Array[hp3,90] (* Harvey P. Dale, Mar 24 2012 *)
    Table[3^IntegerExponent[n, 3], {n, 100}] (* Vincenzo Librandi, Dec 29 2015 *)
  • PARI
    {a(n) = if( n<1, 0, 3^valuation(n, 3))};
    

Formula

Multiplicative with a(p^e) = p^e if p = 3, 1 otherwise. - Mitch Harris, Apr 19 2005
a(n) = n / A038502(n). Dirichlet g.f. zeta(s)*(3^s-1)/(3^s-3). - R. J. Mathar, Jul 12 2012
From Peter Bala, Feb 21 2019: (Start)
a(n) = gcd(n,3^n).
O.g.f.: x/(1 - x) + 2*Sum_{n >= 1} 3^(n-1)*x^(3^n)/ (1 - x^(3^n)). (End)
Sum_{k=1..n} a(k) ~ (2/(3*log(3)))*n*log(n) + (2/3 + 2*(gamma-1)/(3*log(3)))*n, where gamma is Euler's constant (A001620). - Amiram Eldar, Nov 15 2022

A000086 Number of solutions to x^2 - x + 1 == 0 (mod n).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Number of elliptic points of order 3 for Gamma_0(n).
Equivalently, number of fixed points of Gamma_0(n) of type rho.
Values are 0 or a power of 2.
Shadow transform of central polygonal numbers A002061. - Michel Marcus, Jun 06 2013
Empirical: a(n) == A001615(n) (mod 3) for all natural numbers n. - John M. Campbell, Apr 01 2018
From Jianing Song, Jul 03 2018: (Start)
The comment above is true. Since both a(n) and A001615(n) are multiplicative we just have to verify that for prime powers. Note that A001615(p^e) = (p+1)*p^(e-1). For p == 1 (mod 3), p+1 == 2 (mod 3) so (p+1)*p^(e-1) == 2 (mod 3); for p == 2 (mod 3), p+1 is a multiple of 3 so (p+1)*p^(e-1) == 0 (mod 3). For p = 3, if e = 1 then p+1 == 1 (mod 3); if e > 1 then (p+1)*p^(e-1) == 0 (mod 3).
Equivalently, number of solutions to x^2 + x + 1 == 0 (mod n). (End)

Examples

			G.f. = x + x^3 + 2*x^7 + 2*x^13 + 2*x^19 + 2*x^21 + 2*x^31 + 2*x^37 + 2*x^39 + ...
		

References

  • Bruno Schoeneberg, Elliptic Modular Functions, Springer-Verlag, NY, 1974, p. 101.
  • Goro Shimura, Introduction to the Arithmetic Theory of Automorphic Functions, Princeton, 1971, see p. 25, Eq. (3).

Crossrefs

Cf. A341422 (without zeros).

Programs

  • Haskell
    a000086 n = if n `mod` 9 == 0 then 0
      else product $ map ((* 2) . a079978 . (+ 2)) $ a027748_row $ a038502 n
    -- Reinhard Zumkeller, Jun 23 2013
  • Maple
    with(numtheory); A000086 := proc (n) local d, s; if modp(n,9) = 0 then RETURN(0) fi; s := 1; for d in divisors(n) do if isprime(d) then s := s*(1+eval(legendre(-3,d))) fi od; s end: # Gene Ward Smith, May 22 2006
  • Mathematica
    Array[ Function[ n, If[ EvenQ[ n ] || Mod[ n, 9 ]==0, 0, Count[ Array[ Mod[ #^2-#+1, n ]&, n, 0 ], 0 ] ] ], 84 ]
    a[ n_] := If[ n < 1, 0, Length[ Select[ (#^2 - # + 1)/n & /@ Range[n], IntegerQ]]]; (* Michael Somos, Aug 14 2015 *)
    a[n_] := a[n] = Product[{p, e} = pe; Which[p==1 || p==3 && e==1, 1, p==3 && e>1, 0, Mod[p, 3]==1, 2, Mod[p, 3]==2, 0, True, a[p^e]], {pe, FactorInteger[n]}]; Array[a, 105] (* Jean-François Alcover, Oct 18 2018 *)
  • PARI
    {a(n) = if( n<1, 0, sum( x=0, n-1, (x^2 - x + 1)%n==0))}; \\ Nov 15 2002
    
  • PARI
    {a(n) = if( n<1, 0, direuler( p=2, n, if( p==3, 1 + X, if( p%3==2, 1, (1 + X) / (1 - X)))) [n])}; \\ Nov 15 2002
    

Formula

Multiplicative with a(p^e) = 1 if p = 3 and e = 1; 0 if p = 3 and e > 1; 2 if p == 1 (mod 3); 0 if p == 2 (mod 3). - David W. Wilson, Aug 01 2001
a(A226946(n)) = 0; a(A034017(n)) > 0. - Reinhard Zumkeller, Jun 23 2013
a(2*n) = a(3*n + 2) = a(9*n) = a(9*n + 6) = 0. - Michael Somos, Aug 14 2015
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2*sqrt(3)/(3*Pi) = 0.367552... (A165952). - Amiram Eldar, Oct 11 2022

A065330 a(n) = max { k | gcd(n, k) = k and gcd(k, 6) = 1 }.

Original entry on oeis.org

1, 1, 1, 1, 5, 1, 7, 1, 1, 5, 11, 1, 13, 7, 5, 1, 17, 1, 19, 5, 7, 11, 23, 1, 25, 13, 1, 7, 29, 5, 31, 1, 11, 17, 35, 1, 37, 19, 13, 5, 41, 7, 43, 11, 5, 23, 47, 1, 49, 25, 17, 13, 53, 1, 55, 7, 19, 29, 59, 5, 61, 31, 7, 1, 65, 11, 67, 17, 23, 35, 71, 1, 73, 37, 25, 19, 77, 13, 79, 5, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 29 2001

Keywords

Comments

Bennett, Filaseta, & Trifonov show that if n > 8 then a(n^2 + n) > n^0.285. - Charles R Greathouse IV, May 21 2014

Examples

			a(30) = 5.
		

Crossrefs

Programs

  • Haskell
    a065330 = a038502 . a000265  -- Reinhard Zumkeller, Jul 06 2011
    
  • Magma
    [n div Gcd(n, 6^n): n in [1..100]]; // Vincenzo Librandi, Feb 09 2016
  • Maple
    A065330 := proc(n)
        local a,f,p,e ;
        a := 1 ;
        for f in ifactors(n)[2] do
            p := op(1,f) ;
            e := op(2,f) ;
            if p > 3 then
                a := a*p^e ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Jul 12 2012
    with(padic): a := n -> n/(2^ordp(n, 2)*3^ordp(n, 3));
    seq(a(n), n=1..81); # Peter Luschny, Mar 25 2014
  • Mathematica
    f[n_] := Times @@ (First@#^Last@# & /@ Select[FactorInteger@n, First@# != 2 && First@# != 3 &]); Array[f, 81] (* Robert G. Wilson v, Aug 18 2006 *)
    f[n_]:=Denominator[6^n/n];Array[f,100] (* Vladimir Joseph Stephan Orlovsky, Feb 16 2011 *)
    Table[n / GCD[n, 6^n], {n, 100}] (* Vincenzo Librandi, Feb 09 2016 *)
  • PARI
    a(n)=if(n<2,1,if(n%2,if(n%3,n,a(n/3)),a(n/2))) \\ Benoit Cloitre, Jun 04 2007
    
  • PARI
    a(n)=n\gcd(n,6^n) \\ Not very efficient, but simple. Stanislav Sykora, Feb 08 2016
    
  • PARI
    a(n)=n>>valuation(n,2)/3^valuation(n,3) \\ Charles R Greathouse IV, Mar 31 2016
    

Formula

a(n) * A065331(n) = n.
Multiplicative with a(2^e)=1, a(3^e)=1, a(p^e)=p^e, p>3. - Vladeta Jovovic, Nov 02 2001
A106799(n) = A001222(a(n)). - Reinhard Zumkeller, May 19 2005
a(1)=1; then a(2n)=a(n), a(2n+1)=a((2n+1)/3) if 2n+1 is divisible by 3, a(2n+1)=2n+1 otherwise. - Benoit Cloitre, Jun 04 2007
Dirichlet g.f. zeta(s-1)*(1-2^(1-s))*(1-3^(1-s))/ ( (1-2^(-s))*(1-3^(-s)) ). - R. J. Mathar, Jul 04 2011
a(n) = A038502(A000265(n)). - Reinhard Zumkeller, Jul 06 2011
a(n) = n/GCD(n,6^n). - Stanislav Sykora, Feb 08 2016
Sum_{k=1..n} a(k) ~ (1/4) * n^2. - Amiram Eldar, Oct 22 2022

A263272 Self-inverse permutation of nonnegative integers: a(n) = A263273(2*n) / 2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 11, 8, 9, 10, 7, 12, 13, 14, 15, 32, 23, 18, 29, 20, 33, 38, 17, 24, 35, 26, 27, 28, 19, 30, 37, 16, 21, 34, 25, 36, 31, 22, 39, 40, 41, 42, 95, 68, 45, 86, 59, 96, 113, 50, 69, 104, 77, 54, 83, 56, 87, 110, 47, 60, 101, 74, 99, 92, 65, 114, 119, 44, 51, 98, 71, 72, 89, 62, 105, 116, 53, 78, 107, 80, 81
Offset: 0

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; Table[f[2 n]/2, {n, 0, 81}] (* Michael De Vlieger, Jan 04 2016,after Jean-François Alcover at A263273 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
    def a(n): return a263273(2*n)/2 # Indranil Ghosh, May 23 2017
  • Scheme
    (define (A263272 n) (/ (A263273 (+ n n)) 2))
    

Formula

a(n) = A263273(2*n) / 2 = A264984(n) / 2.
As a composition of related permutations:
a(n) = A264974(A264975(n)) = A264976(A264974(n)).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
A264974(n) = a(2n)/2. [Thus the restriction onto even numbers induces yet another permutation.]
Showing 1-10 of 49 results. Next