ARD1 - The Easiest Sequence Of the World!!

no tags 

 

I just found the easiest and funny sequence ever !
Your task is simple. Just write a program to find the Nth term of this sequence!!
The sequence is as follows::
3, 8, 12, 17, 22, 28, 35....

 

I just found the easiest and funny sequence ever !

Your task is simple. Just write a program to find the Nth term of this sequence!!

The sequence is as follows::

3, 8, 12, 17, 22, 28, 35....

 

 

Input

 

First line contains t = number of test cases

and then next t lines follow n. 

1<=n<=10^11

Note-- Value of n is modified to encourage better solutions!

Output

 

Just the output the nth term modulo 123456789

 

Example

Input:
3
1
2
3

Output:
3
8
12

hide comments
numerix: 2012-10-12 04:57:50

I can't see any reason for the language restriction, as the main task is to figure out the sequence. So please open it for all languages and set TL to 1 s to give slower languages a chance. A less strict TL won't give any advantage. If you didn't figure it out, even 10 s won't help.

Utkarsh Shahdeo: 2012-10-12 04:57:50

Last edit: 2012-08-18 13:56:46
Mostafa 36a2: 2012-10-12 04:57:50

it's Not A hint
But Clearly You Can See How it increase
Look At : 673,1054,1668,2659,4260
Got It??

Abhinav Arora: 2012-10-12 04:57:50

Hi can somebody please give a hint?

Aradhya: 2012-10-12 04:57:50

sorry guys. for too short seuence representation ! and thanks to tjandra sir for helping u out :)

Mostafa 36a2: 2012-10-12 04:57:50

@Tjandra
You Are The Best, Man ;)

Last edit: 2012-08-05 18:28:47
NeW AcP: 2012-10-12 04:57:50

Thanks @tjandra sir got acc. now .Definitely it is not the easiest seq in the world!!

Last edit: 2012-08-02 13:45:57
npsabari: 2012-10-12 04:57:50

Nice one!! took a while to figure out the sequence..

Last edit: 2012-07-28 13:03:42
(Tjandra Satria Gunawan)(曾毅昆): 2012-10-12 04:57:50

This is the sequence up to 20th term: 3,8,12,17,22,28,35,44,56,73,98,136,195,288,436,673,1054,1668,2659,4260

Nnavneetsinha: 2012-10-12 04:57:50

I totally agree with all of u three there can be many solutions ,I m also getting my answer as:
15th term--100
16th term--113
17th term--118
but wa??where is the problem setter or any body who can help us out.please increase the sequenceto avoid many solution.or kindly remove this problem.


Added by:Aradhya
Date:2012-06-28
Time limit:0.100s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ASM32-GCC MAWK BC C-CLANG C NCSHARP CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG C99 COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET
Resource:Own Problem