Pell Number

Author

Eric W. Weisstein
December 18, 2021

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/PellNumber.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/PellNumber.html.

©2021 Wolfram Research, Inc. except for portions noted otherwise

Pell Numbers

FullSimplify[PellP[n],n∈Integers&&n>=0]

Table[PellP[n],{n,0,10}]//Simplify

Sum

Sum[Binomial[n,2k+1](2^k),{k,0,Floor[(n-1)/2]}]//Simplify

Table[Sum[Binomial[n,2k+1](2^k),{k,0,Floor[(n-1)/2]}],{n,10}]

Recurrence

RSolve[P[n]==2P[n-1]+P[n-2]&&P[0]==0&&P[1]==1,P[n],n]

Primes

Position[ExpandAll[PellP/@Range[1000]],_?PrimeQ]//Flatten//Timing

l={2,3,5,11,13,29,41,53,59,89,97,101,167,181,191,523,929,1217,1301,1361,2087,2273,2393,8093,13339,14033,23747,28183,34429,36749,90197};

And@@PrimeQ/@l

Do[
Print[{n,l[[n]],IntegerLength[p=ExpandAll[PellP[l[[n]]]]],PrimeQ[p]//Timing}],
{n,Length[l]}]

Pell-Lucas Numbers

PellQ[n_]:=LucasL[n,2]

FullSimplify[PellQ[n],n∈Integers&&n>=0]

Table[ExpandAll[PellQ[n]],{n,0,20}]

Q(n)==(Fibonacci2[n-1, 2])+(Fibonacci2[n+1, 2])

Table[Fibonacci[n-1,2]+Fibonacci[n+1,2],{n,0,10}]

FullSimplify[Fibonacci[n-1,2]+Fibonacci[n+1,2]]

FullSimplify[FunctionExpand[Fibonacci[n-1,2]+Fibonacci[n+1,2]],n∈Integers]

Recurrence

RSolve[Q[n]==2Q[n-1]+Q[n-2]&&Q[0]==2&&Q[1]==2,Q[n],n]

Sum

Simplify[2Sum[Binomial[n,2k](2^k),{k,0,Floor[n/2]}],n>0&&n∈Integers]

In terms of NSW Numbers

Table[(((((1+Sqrt[2]))^((2n-1)))+(((1-Sqrt[2]))^((2n-1))))/2),{n,10}]//Expand

2Table[(((((1+Sqrt[2]))^((2n-1)))+(((1-Sqrt[2]))^((2n-1))))/2),{n,10}]//Expand

Primes

A099088

Position[ExpandAll[PellQ/@Range[1000]],_?PrimeQ]//Flatten//Timing

Position[ExpandAll[PellQ/@Range[1000]]/2,_?PrimeQ]//Flatten//Timing

l={2,3,4,5,7,8,16,19,29,47,59,163,257,421,937,947,1493,1901,6689,8087,9679,28753,79043,129127,145969,165799,168677,170413,172243,278321};

Length[l]

TextGrid[MapIndexed[{#2[[1]],#,IntegerLength[PellQ[#]]}&,l],Dividers->All,Alignment->Decimal]

Select[(l-1)/2,IntegerQ]

And@@((PrimeQ[#]||IntegerQ[Log[2,#]])&/@l)

Do[
Print[{n,l[[n]],IntegerLength[q=ExpandAll[PellQ[l[[n]]]]/2],PrimeQ[q]//Timing}],
{n,Length[l]}]

Do[
Print[{n,l[[n]],PrimeQ[ExpandAll[PellQ[l[[n]]]]/2]//Timing}],
{n,Length[l]}]

Relations

PellP[n_]:=((-(((1-(Sqrt[2])))^n)+(((1+(Sqrt[2])))^n))/(2 (Sqrt[2])))
PellQ[n_]:=(((1-(Sqrt[2])))^n)+(((1+(Sqrt[2])))^n)

P(n (2^s))==P(n) (∏_(j=0)^(s-1))Q((2^j) n)

Product[PellQ[2^j*n],{j,0,s-1}]

Product[Fibonacci[2^j*n-1,2]+Fibonacci[2^j*n+1,2],{j,0,s-1}]

FullSimplify[Table[PellP[2^s*n]==PellP[n]*Product[PellQ[2^j*n],{j,0,s-1}],{n,0,7},{s,0,4}]]

((Q(n))^2)==4 (2 ((P(n))^2)+(((-1))^n))

FullSimplify[Table[Subtract@@{PellQ[n]^2,4*(2*PellP[n]^2+(-1)^n)},{n,0,20}]]

Q(2 n)==((Q(n))^2)-2 (((-1))^n)

FullSimplify[Table[Subtract@@{PellQ[2*n],(PellQ[n]^2-2*(-1)^n)},{n,0,20}]]