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-4 of 4 results.

A285328 a(n) = 1 if n is squarefree (A005117), otherwise a(n) = Max {m < n | same prime factors as n, ignoring multiplicity}.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 4, 3, 1, 1, 6, 1, 1, 1, 8, 1, 12, 1, 10, 1, 1, 1, 18, 5, 1, 9, 14, 1, 1, 1, 16, 1, 1, 1, 24, 1, 1, 1, 20, 1, 1, 1, 22, 15, 1, 1, 36, 7, 40, 1, 26, 1, 48, 1, 28, 1, 1, 1, 30, 1, 1, 21, 32, 1, 1, 1, 34, 1, 1, 1, 54, 1, 1, 45, 38, 1, 1, 1, 50, 27, 1, 1, 42, 1, 1, 1, 44, 1, 60, 1, 46, 1, 1, 1, 72, 1, 56, 33, 80, 1, 1, 1, 52, 1, 1, 1, 96
Offset: 1

Views

Author

Antti Karttunen, Apr 17 2017

Keywords

Examples

			From _Michael De Vlieger_, Dec 31 2018: (Start)
a(1) = 1 since 1 is squarefree.
a(2) = 1 since 2 is squarefree.
a(4) = 2 since 4 is not squarefree and 2 is the largest number less than 4 that has all the distinct prime divisors that 4 has.
a(6) = 1 since 6 is squarefree.
a(12) = 6 since 12 is not squarefree and 6 is the largest number less than 12 that has all the distinct prime divisors that 12 has. (6 is also the squarefree root of 12).
a(16) = 8 since 16 is not squarefree and 8 is the largest number less than 16 that has all the distinct prime divisors that 16 has.
a(18) = 12 since 18 is not squarefree and 12 is the largest number less than 18 that has all the distinct prime divisors that 18 has.
(End)
		

Crossrefs

A left inverse of A065642.
Cf. also A079277.

Programs

  • Mathematica
    Table[With[{r = DivisorSum[n, EulerPhi[#] Abs@ MoebiusMu[#] &]}, If[MoebiusMu@ n != 0, 1, SelectFirst[Range[n - 2, 2, -1], DivisorSum[#, EulerPhi[#] Abs@ MoebiusMu[#] &] == r &]]], {n, 108}] (* Michael De Vlieger, Dec 31 2018 *)
  • PARI
    A007947(n) = factorback(factorint(n)[, 1]); \\ From Andrew Lelechenko, May 09 2014
    A285328(n) = { my(r=A007947(n)); if(core(n)==n,1,n = n-r; while(A007947(n) <> r, n = n-r); n); }; \\ After Python-code below - Antti Karttunen, Apr 17 2017
    A285328(n) = { my(r); if((n > 1 && !bitand(n,(n-1))),(n/2), r=A007947(n); if(r==n,1,n = n-r; while(A007947(n) <> r, n = n-r); n)); }; \\ Version optimized for powers of 2.
    
  • Python
    from operator import mul
    from sympy import primefactors
    from sympy.ntheory.factor_ import core
    def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))
    def a(n):
        if core(n) == n: return 1
        r = a007947(n)
        k = n - r
        while k>0:
            if a007947(k) == r: return k
            else: k -= r
    print([a(n) for n in range(1, 121)]) # Indranil Ghosh and Antti Karttunen, Apr 17 2017
  • Scheme
    (definec (A285328 n) (if (not (zero? (A008683 n))) 1 (let ((k (A007947 n))) (let loop ((n (- n k))) (if (= (A007947 n) k) n (loop (- n k)))))))
    

Formula

If A008683(n) <> 0, a(n) = 1, otherwise a(n) = the largest number k < n for which A007947(k) = A007947(n).
Other identities. For all n >= 1:
a(A065642(n)) = n.

A285331 Inverse for A285332: a(1) = 0, a(2) = 1, a(A019565(n)) = 2*a(n), a(A065642(n)) = 1 + 2*a(n).

Original entry on oeis.org

0, 1, 2, 3, 6, 4, 14, 7, 5, 12, 30, 9, 62, 10, 8, 15, 126, 19, 254, 25, 24, 252, 510, 39, 13, 76, 11, 21, 1022, 28, 2046, 31, 38, 316, 18, 79, 4094
Offset: 1

Views

Author

Antti Karttunen, Apr 17 2017, comments edited Apr 19 2017

Keywords

Comments

Note the indexing: the domain starts from 1, while the range includes also zero.
For the question whether this sequence and A285332 are permutations of natural numbers, see comments in A285332 and the conjecture stated in A019565.
As a practical problem, it seems next-to-impossible to compute even the value of a(38). Even though we know that 38 certainly is not in a finite cycle of A019565, because A048675(38) = 129, A048675(129) = 8194 and A048675(8194) = 4503599627370561 which factorizes as 3^2 * 37 * 71 * 190483425427 (thus is not squarefree and A285320(38) = 3), the value of a(38) is most likely so huge that it will not fit into the data section or even into a b-file. The same problem applies to all numbers that share prime factors with 38, namely 76, 152, 304, 608, 722, ...
Terms a(39) .. a(61) are [632, 51, 8190, 60, 16382, 505, 17, 72057594037927932, 32766, 159, 29, 103, 1016, 153, 65534, 319, 50, 43, 16376, 131014, 131070, 57, 262142].
The name is slightly misleading. The given definition of a(n) is not always very helpful to compute the terms (cf. example of n = 38), it is actually not clear whether the sequence is well defined. - M. F. Hasler, Mar 01 2018

Examples

			a(1) = 0 and a(2) = 1 by definition.
a(3) = a(prime(2)) = a(A019565(2^1)) = 2*a(2) = 2.
a(4) = a(2^2) = a(A065642(2)) = 1 + 2*a(2) = 3.
a(5) = a(prime(3)) = a(A019565(2^2)) = 2*a(4) = 6.
a(9) = a(3^2) = a(A065642(3)) = 1 + 2*a(3) = 5.
a(10) = a(2*5) = a(prime(1)*prime(3)) = a(A019565(2^0+2^2)) = 2*a(1+4) = 12.
To compute a(38), write 38 = prime(1)*prime(8) = A019565(2^7+2^0), so a(38) = 2*a(129). To compute this, use 129 = prime(2)*prime(14) = A019565(2^13+2^1), so a(129) = 2*a(8194). But 8194 = prime(1)*prime(7)*prime(53) = A019565(2^0+2^6+2^52), so a(8194) = 2*a(4503599627370561)...
		

Crossrefs

Inverse: A285332.
Compare also to permutation A285111.

Programs

Formula

a(1) = 0, a(2) = 1, and for n > 2, if A008683(n) <> 0 [when n is squarefree], a(n) = 2*a(A048675(n)), otherwise a(n) = 1 + 2*a(A285328(n)).
For all n >= 0, a(A285332(n)) = n.

A285112 Permutation of natural numbers: a(0) = 1, a(1) = 2, a(2n) = A005117(1+a(n)), a(2n+1) = A065642(a(n)).

Original entry on oeis.org

1, 2, 3, 4, 5, 9, 6, 8, 7, 25, 14, 27, 10, 12, 13, 16, 11, 49, 39, 125, 22, 28, 42, 81, 15, 20, 19, 18, 21, 169, 26, 32, 17, 121, 79, 343, 65, 117, 205, 625, 35, 44, 43, 56, 69, 84, 133, 243, 23, 45, 33, 40, 31, 361, 30, 24, 34, 63, 277, 2197, 41, 52, 53, 64, 29, 289, 199, 1331, 130, 6241, 563, 2401, 106, 325, 193, 351, 335, 1025, 1030, 3125, 58
Offset: 0

Views

Author

Antti Karttunen, Apr 17 2017

Keywords

Comments

Note the indexing: the domain starts from 0, while the range excludes zero.
This sequence can be represented as a binary tree. Each left hand child is produced as A005117(1+n), and each right hand child as A065642(n), when the parent node contains n >= 2:
1
|
...................2...................
3 4
5......../ \........9 6......../ \........8
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
7 25 14 27 10 12 13 16
11 49 39 125 22 28 42 81 15 20 19 18 21 169 26 32
etc.

Crossrefs

Inverse: A285111.
Similar or related permutations: A243344, A243346, A252753, A277696, A284572.
Cf. also arrays A284457 & A284311.

Formula

a(0) = 1, a(1) = 2, a(2n) = A005117(1+a(n)), a(2n+1) = A065642(a(n)).

A284571 Permutation of natural numbers: a(1) = 1, a(A005117(1+n)) = 2*a(n), a(A065642(1+n)) = 1 + 2*a(n).

Original entry on oeis.org

1, 2, 4, 3, 8, 6, 16, 9, 5, 12, 32, 17, 18, 10, 24, 33, 64, 65, 34, 11, 36, 20, 48, 129, 7, 66, 19, 37, 128, 130, 68, 49, 22, 72, 40, 97, 96, 258, 14, 69, 132, 38, 74, 73, 21, 256, 260, 81, 13, 29, 136, 15, 98, 521, 44, 39, 144, 80, 194, 257, 192, 516, 23, 137, 28, 138, 264, 45, 76, 148, 146, 197, 42, 512, 147, 193, 520, 162, 26, 27
Offset: 1

Views

Author

Antti Karttunen, Apr 17 2017

Keywords

Crossrefs

Inverse: A284572.
Similar or related permutations: A243343, A243345, A277695, A285111.

Programs

  • Python
    from operator import mul
    from sympy import primefactors
    from sympy.ntheory.factor_ import core
    def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))
    def a285328(n):
        if core(n) == n: return 1
        k=n - 1
        while k>0:
            if a007947(k) == a007947(n): return k
            else: k-=1
    def a013928(n): return sum(1 for i in range(1, n) if core(i) == i)
    def a(n):
        if n==1: return 1
        if core(n)==n: return 2*a(a013928(n))
        else: return 1 + 2*a(a285328(n) - 1)
    [a(n) for n in range(1, 121)] # Indranil Ghosh, Apr 17 2017

Formula

a(1) = 1, for n > 1, if A008683(n) <> 0 [when n is squarefree], a(n) = 2*a(A013928(n)), otherwise a(n) = 1 + 2*a(A285328(n)-1).
Showing 1-4 of 4 results.