login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A054793
Earliest sequence with a(a(n)) = n^4.
1
0, 1, 3, 16, 5, 256, 7, 1296, 9, 4096, 11, 10000, 13, 20736, 15, 38416, 81, 18, 83521, 20, 130321, 22, 194481, 24, 279841, 26, 390625, 28, 531441, 30, 707281, 32, 923521, 34, 1185921, 36, 1500625, 38, 1874161, 40, 2313441, 42, 2825761, 44, 3418801, 46
OFFSET
0,3
FORMULA
if n is a 4th power then a(n)=a(n^(1/4))^4, otherwise if the difference between n and the highest 4th power less than n is odd then a(n)=n+1, otherwise a(n)=(n-1)^4.
MATHEMATICA
a[n_] := a[n] = Which[r = n^(1/4); IntegerQ[r], a[r]^4, OddQ[n - Floor[r]^4], n+1, True, (n-1)^4]; a[0]=0; a[1]=1; Table[a[n], {n, 0, 45}] (* Jean-François Alcover, Aug 07 2012, after formula *)
PROG
(Python)
from sympy import integer_nthroot
def A054793(n):
a, b = integer_nthroot(n, 4)
return n if n <= 1 else A054793(a)**4 if b else n+1 if (n-a**4) % 2 else (n-1)**4 # Chai Wah Wu, Apr 02 2021
CROSSREFS
Sequence in context: A139815 A165969 A098373 * A063709 A195880 A237671
KEYWORD
nonn,nice
AUTHOR
Henry Bottomley, Apr 27 2000
STATUS
approved