The Lucas number series is similar to Fibonacci series. In Lucas Series, the next number is the sum of previous two numbers like fibonacci number series, but here the series starts with 2 and 1, next numbers are the sum of previous two numbers.

For Example:

2, 1, 3, 4, 7, 11, 18, 23,......

Here, the first two numbers are 2 & 1. The next numbers are as follows:

         3  => (1+2)
         4  => (3+1)
         7  => (4+3)
         11 => (7+4)
        and so on.

Let's see the code of Lucas series:

import java.util.*;
public class Main
{
	public static void main(String[] args) {
		int a=2,b=1,c,i;
		Scanner sc=new Scanner(System.in);
		System.out.println("Enter the length of lucas series:");
		int len=sc.nextInt();
		for(i=1;i<=len;i++){
		    c=a+b;
		    System.out.print(c+" ");
		    a=b;
		    b=c;
		}
	}
}
		

 

Output of the Lucas Series:

Enter the length of lucas series:                                                                                             
5                                                                                                                             
3 4 7 11 18