A260443 Prime factorization representation of Stern polynomials: a(0) = 1, a(1) = 2, a(2n) = A003961(a(n)), a(2n+1) = a(n)*a(n+1).
1, 2, 3, 6, 5, 18, 15, 30, 7, 90, 75, 270, 35, 450, 105, 210, 11, 630, 525, 6750, 245, 20250, 2625, 9450, 77, 15750, 3675, 47250, 385, 22050, 1155, 2310, 13, 6930, 5775, 330750, 2695, 3543750, 128625, 1653750, 847, 4961250, 643125, 53156250, 18865, 24806250, 202125, 727650, 143, 1212750, 282975, 57881250, 29645, 173643750, 1414875, 18191250, 1001
Offset: 0
Examples
n a(n) prime factorization Stern polynomial ------------------------------------------------------------ 0 1 (empty) B_0(x) = 0 1 2 p_1 B_1(x) = 1 2 3 p_2 B_2(x) = x 3 6 p_2 * p_1 B_3(x) = x + 1 4 5 p_3 B_4(x) = x^2 5 18 p_2^2 * p_1 B_5(x) = 2x + 1 6 15 p_3 * p_2 B_6(x) = x^2 + x 7 30 p_3 * p_2 * p_1 B_7(x) = x^2 + x + 1 8 7 p_4 B_8(x) = x^3 9 90 p_3 * p_2^2 * p_1 B_9(x) = x^2 + 2x + 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..4096 (first 1025 terms from Antti Karttunen)
Crossrefs
Same sequence sorted into ascending order: A260442.
Cf. A000040, A000079, A000225, A001222, A002487, A003415, A003961, A005811, A007949, A046523, A056239, A073491, A090880, A097249, A101979, A125184, A178590, A186891, A206284, A277314, A277315, A277325, A277326, A277329, A277330, A277701, A277705, A277899, A278243, A278530, A278544, A284010, A284011.
Cf. A277323, A277324 (bisections), A277200 (even terms sorted), A277197 (first differences), A277198.
Cf. A023758 (positions of squarefree terms), A101082 (of terms not squarefree), A277702 (positions of records), A277703 (their values).
Cf. also A206296 (Fibonacci polynomials similarly represented).
Programs
-
Maple
b:= n-> mul(nextprime(i[1])^i[2], i=ifactors(n)[2]): a:= proc(n) option remember; `if`(n<2, n+1, `if`(irem(n, 2, 'h')=0, b(a(h)), a(h)*a(n-h))) end: seq(a(n), n=0..56); # Alois P. Heinz, Jul 04 2024
-
Mathematica
a[n_] := a[n] = Which[n < 2, n + 1, EvenQ@ n, Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1] &@ a[n/2], True, a[#] a[# + 1] &[(n - 1)/2]]; Table[a@ n, {n, 0, 56}] (* Michael De Vlieger, Apr 05 2017 *)
-
PARI
A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From Michel Marcus A260443(n) = if(n<2, n+1, if(n%2, A260443(n\2)*A260443(n\2+1), A003961(A260443(n\2)))); \\ After Charles R Greathouse IV's code for "ps" in A186891. \\ Antti Karttunen, Oct 11 2016
-
Python
from sympy import factorint, prime, primepi from functools import reduce from operator import mul def a003961(n): F = factorint(n) return 1 if n==1 else reduce(mul, (prime(primepi(i) + 1)**F[i] for i in F)) def a(n): return n + 1 if n<2 else a003961(a(n//2)) if n%2==0 else a((n - 1)//2)*a((n + 1)//2) print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 21 2017
-
Scheme
;; Uses memoization-macro definec: (definec (A260443 n) (cond ((<= n 1) (+ 1 n)) ((even? n) (A003961 (A260443 (/ n 2)))) (else (* (A260443 (/ (- n 1) 2)) (A260443 (/ (+ n 1) 2)))))) ;; A more standalone version added Oct 10 2016, requiring only an implementation of A000040 and the memoization-macro definec: (define (A260443 n) (product_primes_to_kth_powers (A260443as_coeff_list n))) (define (product_primes_to_kth_powers nums) (let loop ((p 1) (nums nums) (i 1)) (cond ((null? nums) p) (else (loop (* p (expt (A000040 i) (car nums))) (cdr nums) (+ 1 i)))))) (definec (A260443as_coeff_list n) (cond ((zero? n) (list)) ((= 1 n) (list 1)) ((even? n) (cons 0 (A260443as_coeff_list (/ n 2)))) (else (add_two_lists (A260443as_coeff_list (/ (- n 1) 2)) (A260443as_coeff_list (/ (+ n 1) 2)))))) (define (add_two_lists nums1 nums2) (let ((len1 (length nums1)) (len2 (length nums2))) (cond ((< len1 len2) (add_two_lists nums2 nums1)) (else (map + nums1 (append nums2 (make-list (- len1 len2) 0)))))))
Formula
Extensions
More linking formulas added by Antti Karttunen, Mar 21 2017
Comments