OFFSET
0,2
COMMENTS
Each term is a prime factorization encoding of one of the Stern polynomials. See A260443 for details.
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..10000
PROG
(PARI)
allocatemem(2^30);
A048675(n) = my(f = factor(n)); sum(k=1, #f~, f[k, 2]*2^primepi(f[k, 1]))/2; \\ Michel Marcus, Oct 10 2016
A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From Michel Marcus
A055396(n) = if(n==1, 0, primepi(factor(n)[1, 1])) \\ Charles R Greathouse IV, Apr 23 2015
A061395(n) = if(1==n, 0, primepi(vecmax(factor(n)[, 1]))); \\ After M. F. Hasler's code for A006530.
isA260442(n) = ((1==n) || isprime(n) || ((omega(n) == 1+(A061395(n)-A055396(n))) && (A260443(A048675(n)) == n))); \\ Somewhat optimized.
i=0; n=0; while(i < 10001, n++; if(isA260442(n), write("b260442.txt", i, " ", n); i++));
\\ Antti Karttunen, Oct 14 2016
(Scheme, with Antti Karttunen's IntSeq-library)
;; An optimized version:
(define A260442 (MATCHING-POS 0 1 (lambda (n) (or (= 1 n) (= 1 (A010051 n)) (and (not (< (A001221 n) (+ 1 (A243055 n)))) (= n (A260443 (A048675 n))))))))
-- Antti Karttunen, Oct 14 2016
(Python)
from sympy import factorint, prime, primepi
from operator import mul
from functools import reduce
def a048675(n):
F=factorint(n)
return 0 if n==1 else sum([F[i]*2**(primepi(i) - 1) for i in F])
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([n for n in range(301) if a(a048675(n))==n]) # Indranil Ghosh, Jun 21 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jul 29 2015
STATUS
approved